Skip to content

StefanSchoof/terraform-azurerm-static-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-azurerm-static-website

A module to enable a static website for an azure storage account. This is a workaround until hashicorp/terraform-provider-azurerm#1903 is resolved

Limtations

  1. You need a valid session in the Azure CLI (even when you Authenticating terrafrom not with the Azure CLI)
  2. A destroy does not disable the website. You must first set enabled to false and apply. The you can remove the resource
  3. A change outside from terrafrom is not detect and a reapply will not fix this.

Example

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
}

About

A Terraform module to activate a static website on a azure storage

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages