diff --git a/main.tf b/main.tf index f356956..ea182c8 100644 --- a/main.tf +++ b/main.tf @@ -71,9 +71,13 @@ resource "azurerm_mysql_flexible_server" "main" { standby_availability_zone = lookup(high_availability.value, "standby_availability_zone", 1) } } - identity { - type = var.identity_type - identity_ids = var.identity_type == "UserAssigned" ? var.user_assigned_identity_ids : [] + dynamic "identity" { + for_each = toset(var.identity_type != null ? [var.identity_type] : []) + content { + type = var.identity_type + identity_ids = var.identity_type == "UserAssigned" ? var.user_assigned_identity_ids : [] + } + } version = var.mysql_version @@ -97,7 +101,7 @@ resource "azurerm_mysql_flexible_server_active_directory_administrator" "main" { object_id = var.entra_authentication.object_id tenant_id = data.azurerm_client_config.current.tenant_id - depends_on = [ azurerm_mysql_flexible_server.main ] + depends_on = [azurerm_mysql_flexible_server.main] } ##----------------------------------------------------------------------------- diff --git a/output.tf b/output.tf index 81c9840..1fdd5ea 100644 --- a/output.tf +++ b/output.tf @@ -21,9 +21,9 @@ output "azurerm_private_dns_zone_id" { } output "password_result" { - value = var.admin_password == null ? random_password.main[0].result : var.admin_password + value = var.admin_password == null ? random_password.main[0].result : var.admin_password description = "Password Value" - sensitive = true + sensitive = true } diff --git a/variables.tf b/variables.tf index d19783c..9a72fc8 100644 --- a/variables.tf +++ b/variables.tf @@ -298,7 +298,7 @@ variable "eventhub_authorization_rule_id" { } variable "custom_tags" { - type = map(string) + type = map(string) default = {} }