From 870036b14ec6e44f17edb8970c519d7a6ef76a4d Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Fri, 18 Apr 2025 15:42:19 -0500 Subject: [PATCH] adding static web to storage account --- modules/storage/static_website.tf | 6 ++++++ modules/storage/storage_account.tf | 8 -------- modules/storage/variables.tf | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 modules/storage/static_website.tf diff --git a/modules/storage/static_website.tf b/modules/storage/static_website.tf new file mode 100644 index 0000000..078d510 --- /dev/null +++ b/modules/storage/static_website.tf @@ -0,0 +1,6 @@ +resource "azurerm_storage_account_static_website" "static_website" { + count = length(var.storage_tables) + storage_account_id = azurerm_storage_account.storage_account.id + error_404_document = var.static_websites[count.index].error_404_document + index_document = var.static_websites[count.index].index_document +} \ No newline at end of file diff --git a/modules/storage/storage_account.tf b/modules/storage/storage_account.tf index 5b4a116..ee5ac04 100644 --- a/modules/storage/storage_account.tf +++ b/modules/storage/storage_account.tf @@ -4,12 +4,4 @@ resource "azurerm_storage_account" "storage_account" { location = data.azurerm_resource_group.resource_group.location account_tier = var.account_tier account_replication_type = var.account_replication_type - - dynamic static_website { - for_each = var.static_websites - - content { - index_document = static_website.value.index_document - } - } } \ No newline at end of file diff --git a/modules/storage/variables.tf b/modules/storage/variables.tf index e4da4fe..8f40be7 100644 --- a/modules/storage/variables.tf +++ b/modules/storage/variables.tf @@ -15,6 +15,7 @@ variable "resource_group_name" { variable "static_websites" { default = [] type = list(object({ + error_404_document = string index_document = string })) }