From eacc0e7f30d50cd7c6dd4efbb187682dfe545671 Mon Sep 17 00:00:00 2001 From: ArtiomMatiom Date: Tue, 3 Dec 2024 09:34:51 +0100 Subject: [PATCH] fix null dimension access --- modules/azure/monitoring_metric_alert/main.tf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/azure/monitoring_metric_alert/main.tf b/modules/azure/monitoring_metric_alert/main.tf index e7facbc..2531b29 100644 --- a/modules/azure/monitoring_metric_alert/main.tf +++ b/modules/azure/monitoring_metric_alert/main.tf @@ -36,10 +36,13 @@ resource "azurerm_monitor_metric_alert" "metric_alert" { operator = each.value.operator threshold = each.value.threshold - dimension { - name = each.value.dimension.name - operator = each.value.dimension.operator - values = each.value.dimension.values + dynamic "dimension" { + for_each = each.value.dimension != null ? [1] : [] + content { + name = each.value.dimension.name + operator = each.value.dimension.operator + values = each.value.dimension.values + } } }