diff --git a/modules/storage-account/src/main.tf b/modules/storage-account/src/main.tf index 9eaefd2..dc04285 100644 --- a/modules/storage-account/src/main.tf +++ b/modules/storage-account/src/main.tf @@ -7,11 +7,19 @@ resource "azurerm_storage_account" "main" { account_replication_type = var.account_replication_type min_tls_version = "TLS1_2" + dynamic "custom_domain" { + for_each = var.custom_domain != null ? [var.custom_domain] : [] + content { + name = custom_domain.value.name + use_subdomain = custom_domain.value.use_subdomain + } + } + dynamic "static_website" { for_each = var.static_website != null ? [var.static_website] : [] content { - index_document = static_website.value.index_document error_404_document = static_website.value.error_404_document + index_document = static_website.value.index_document } } diff --git a/modules/storage-account/src/variables.tf b/modules/storage-account/src/variables.tf index 54c7282..ad028da 100644 --- a/modules/storage-account/src/variables.tf +++ b/modules/storage-account/src/variables.tf @@ -8,6 +8,14 @@ variable "account_replication_type" { default = "ZRS" } +variable "custom_domain" { + type = object({ + name = string + use_subdomain = bool + }) + default = null +} + variable "environment" { type = string } @@ -38,8 +46,8 @@ variable "resource_group_name" { variable "static_website" { type = object({ - index_document = string error_404_document = string + index_document = string }) default = null }