Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


Terraform AzureRM - azurerm_static_site

Guide to managing Azure Static Web Apps using Terraform.

Prerequisite

If you need to install The azurerm Terraform provider, follow:

Declare Static Site

Resource Block

The local name will need setting.

resource "azurerm_static_site" "<local name>" {
}

Required Arguments

The required arguments are:

name

The name of the Static Web App.

name = "<app or stapp>-<project, app or service>-<environment>-<###>"

Changing this argument will recreate the resource.

location

Specifies the location of the resource.

At the time of writing, valid arguments are:

  • Central US
  • East US 2
  • East Asia
  • West Europe
  • West US 2
location = "westeurope"

Changing this argument will recreate the resource.

resource_group_name

Specifies the resource group the Static Web App should reside in.

resource_group_name = azurerm_resource_group.<local name>.name

Changing this argument will recreate the resource.

Optional Arguments

The optional arguments are:

sku_tier

Specifies the SKU tier.

Valid options are:

  • Free
  • Standard
sku_tier = "Free"

sku_size

Specifies the SKU size.

Valid options are:

  • Free
  • Standard
sku_size = "Free"

identity

The identity block takes 2 arguments:

type

This is required, and can be set to either:

  • SystemAssigned
  • UserAssigned
  • SystemAssigned, UserAssigned
identity_ids

These are an optional list of managed identities that should be assigned to the resource.

Requires a Standard sku_tier.

tags

Set as many key value pairs that you need.

tags = {
  environment = "demo"
  source      = "terraform"
}

Example Declaration

This is an example for declaring a Static Web App:

resource "azurerm_static_site" "stapp-dtvlinux-001" {
  name                = "stapp-dtvlinux-demo-001"
  location            = "westeurope"
  resource_group_name = "rg-app-demo-001"
  sku_size            = "Free"
  sku_tier            = "Free"
  tags                = {
    environment = "demo"
    source      = "terraform"
  }
}

Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.