diff --git a/main.tf b/main.tf index f518218..b901bea 100644 --- a/main.tf +++ b/main.tf @@ -452,7 +452,7 @@ locals { resource_group_name = var.resource_group_name location = var.location valid_rg_name = var.existing_private_dns_zone == null ? local.resource_group_name : (var.existing_private_dns_zone_resource_group_name == "" ? local.resource_group_name : var.existing_private_dns_zone_resource_group_name) - private_dns_zone_name = var.existing_private_dns_zone == null ? azurerm_private_dns_zone.dnszone[0].name : var.existing_private_dns_zone + private_dns_zone_name = var.enable_private_endpoint && var.enabled ? var.existing_private_dns_zone == null ? azurerm_private_dns_zone.dnszone[0].name : var.existing_private_dns_zone : null } ##----------------------------------------------------------------------------- diff --git a/outputs.tf b/outputs.tf index 44ef1b8..f0d6b5a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,41 +1,41 @@ output "storage_account_id" { - value = azurerm_storage_account.storage[0].id + value = try(azurerm_storage_account.storage[0].id, null) description = "The ID of the storage account." } output "storage_account_name" { - value = azurerm_storage_account.storage[0].name + value = try(azurerm_storage_account.storage[0].name, null) description = "The name of the storage account." } output "storage_account_primary_location" { - value = azurerm_storage_account.storage[0].primary_location + value = try(azurerm_storage_account.storage[0].primary_location, null) description = "The primary location of the storage account" } output "storage_account_primary_web_endpoint" { - value = azurerm_storage_account.storage[0].primary_web_endpoint + value = try(azurerm_storage_account.storage[0].primary_web_endpoint, null) description = "The endpoint URL for web storage in the primary location." } output "storage_account_primary_blob_endpoint" { - value = azurerm_storage_account.storage[0].primary_blob_endpoint + value = try(azurerm_storage_account.storage[0].primary_blob_endpoint, null) description = "The endpoint URL for blob storage in the primary location." } output "storage_account_primary_web_host" { - value = azurerm_storage_account.storage[0].primary_web_host + value = try(azurerm_storage_account.storage[0].primary_web_host, null) description = "The hostname with port if applicable for web storage in the primary location." } output "storage_primary_connection_string" { - value = azurerm_storage_account.storage[0].primary_connection_string + value = try(azurerm_storage_account.storage[0].primary_connection_string, null) sensitive = true description = "The primary connection string for the storage account" } output "storage_primary_access_key" { - value = azurerm_storage_account.storage[0].primary_access_key + value = try(azurerm_storage_account.storage[0].primary_access_key, null) sensitive = true description = "The primary access key for the storage account" } diff --git a/variables.tf b/variables.tf index dde3c21..c2f73b4 100644 --- a/variables.tf +++ b/variables.tf @@ -370,7 +370,7 @@ variable "subnet_id" { variable "enable_private_endpoint" { type = bool - default = false + default = true description = "enable or disable private endpoint to storage account" }