Skip to content

azurermStaticSite

Manages an App Service Static Site.

->NOTE: After the Static Site is provisioned, you'll need to associate your target repository, which contains your web app, to the Static Site, by following the Azure Static Site document.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.staticSite.StaticSite(this, "example", {
  location: "West Europe",
  name: "example",
  resource_group_name: "example",
});

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Static Web App. Changing this forces a new Static Web App to be created.

  • location - (Required) The Azure Region where the Static Web App should exist. Changing this forces a new Static Web App to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Static Web App should exist. Changing this forces a new Static Web App to be created.

  • skuTier - (Optional) Specifies the SKU tier of the Static Web App. Possible values are free or standard. Defaults to free.

  • skuSize - (Optional) Specifies the SKU size of the Static Web App. Possible values are free or standard. Defaults to free.

  • identity - (Optional) An identity block as defined below.

  • tags - (Optional) A mapping of tags to assign to the resource.


An identity block supports the following:

  • type - (Required) The Type of Managed Identity assigned to this Static Site resource. Possible values are systemAssigned, userAssigned and systemAssigned,UserAssigned.

  • identityIds - (Optional) A list of Managed Identity IDs which should be assigned to this Static Site resource.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Static Web App.

  • apiKey - The API key of this Static Web App, which is used for later interacting with this Static Web App from other clients, e.g. GitHub Action.

  • defaultHostName - The default host name of the Static Web App.

  • identity - (Optional) An identity block as defined below which contains the Managed Service Identity information for this resource.


An identity block exports the following:

  • type - (Required) The Type of Managed Identity assigned to this resource. Possible values are systemAssigned, userAssigned and systemAssigned,UserAssigned.

  • principalId - (Optional) The Principal ID associated with this Managed Service Identity.

-> You can access the Principal ID via azurermStaticSiteExampleIdentity0PrincipalId

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Static Web App.
  • read - (Defaults to 5 minutes) Used when retrieving the Static Web App.
  • update - (Defaults to 30 minutes) Used when updating the Static Web App.
  • delete - (Defaults to 30 minutes) Used when deleting the Static Web App.

Import

Static Web Apps can be imported using the resourceId, e.g.

terraform import azurerm_static_site.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1