From 204e40e87432bf842771d57be51eb78a263eddb1 Mon Sep 17 00:00:00 2001 From: Marco Maurer Date: Wed, 11 Sep 2024 11:40:26 +0200 Subject: [PATCH] fix: Wrap try() with coalesce() to overcome non-null defaults --- grafana_alert.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grafana_alert.tf b/grafana_alert.tf index f44bcfb..66d4914 100644 --- a/grafana_alert.tf +++ b/grafana_alert.tf @@ -27,9 +27,9 @@ resource "grafana_rule_group" "this" { annotations = {for k, v in rule.value.annotations : k => replace(v, "$value", "$values.QUERY_RESULT.Value")} labels = merge(rule.value.labels, try(var.overrides[rule.value.alert].labels, {})) - exec_err_state = try(var.overrides[rule.value.alert].exec_err_state, "Error") + exec_err_state = coalesce(try(var.overrides[rule.value.alert].exec_err_state, null), "Error") is_paused = try(var.overrides[rule.value.alert].is_paused, null) - no_data_state = try(var.overrides[rule.value.alert].no_data_state, "OK") + no_data_state = coalesce(try(var.overrides[rule.value.alert].no_data_state, null), "OK") data { ref_id = "QUERY" @@ -101,7 +101,7 @@ resource "grafana_rule_group" "this" { "conditions" = [ { "evaluator" = { - "params" = [try(var.overrides[rule.value.alert].alert_threshold, 0)] + "params" = [coalesce(try(var.overrides[rule.value.alert].alert_threshold, null), 0)] "type" = "gt" } "operator" = {