From 0bbdb3e4c17855bb742c7bc60a4f8baff1364949 Mon Sep 17 00:00:00 2001 From: Deepak Verma Date: Wed, 30 Oct 2024 13:04:33 +0530 Subject: [PATCH 1/2] fix identity block --- main.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index f356956..54e37b5 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 + 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 From 401896250fe7d50395ad821f30c831b240e90692 Mon Sep 17 00:00:00 2001 From: Deepak Verma Date: Wed, 30 Oct 2024 13:05:38 +0530 Subject: [PATCH 2/2] fmt run --- main.tf | 8 ++++---- output.tf | 4 ++-- variables.tf | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index 54e37b5..ea182c8 100644 --- a/main.tf +++ b/main.tf @@ -71,13 +71,13 @@ resource "azurerm_mysql_flexible_server" "main" { standby_availability_zone = lookup(high_availability.value, "standby_availability_zone", 1) } } - dynamic "identity" { + 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 : [] + identity_ids = var.identity_type == "UserAssigned" ? var.user_assigned_identity_ids : [] } - + } version = var.mysql_version @@ -101,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 = {} }