A module to enable a static website for an azure storage account. This is a workaround until hashicorp/terraform-provider-azurerm#1903 is resolved
- You need a valid session in the Azure CLI (even when you Authenticating terrafrom not with the Azure CLI)
- A destroy does not disable the website. You must first set
enabled
to false and apply. The you can remove the resource - A change outside from terrafrom is not detect and a reapply will not fix this.
resource "azurerm_resource_group" "testrg" {
name = "resourceGroupName"
location = "westus"
}
resource "azurerm_storage_account" "testsa" {
name = "storageaccountname"
resource_group_name = azurerm_resource_group.testrg.name
location = "westus"
account_tier = "Standard"
account_kind = "StorageV2"
account_replication_type = "GRS"
}
module "staticweb" {
source = "StefanSchoof/static-website/azurerm"
storage_account_name = azurerm_storage_account.testsa.name
}
data "azurerm_storage_account" "test" {
name = azurerm_storage_account.testsa.name
resource_group_name = azurerm_resource_group.testrg.name
depends_on = ["module.staticweb"]
}
output "static-web-url" {
value = data.azurerm_storage_account.test.primary_web_endpoint
}