From d67b241a12d1171b629e852766300adb9e4711c0 Mon Sep 17 00:00:00 2001 From: zied-elouaer Date: Fri, 24 May 2024 17:18:21 +0200 Subject: [PATCH] fix: ternary logic in subscriptions breaks some edge cases --- subscriptions.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subscriptions.tf b/subscriptions.tf index 23db1c7..645b19c 100644 --- a/subscriptions.tf +++ b/subscriptions.tf @@ -1,11 +1,12 @@ locals { - subscriptions_map = { for subscription in var.subscriptions : subscription.name => subscription } + subscriptions_map = { for subscription in var.subscriptions : subscription.name => subscription } + subscriptions_map_selector = [local.subscriptions_map, {}] } module "subscription" { source = "github.com/mineiros-io/terraform-google-pubsub-subscription?ref=v1.0.0" - for_each = var.module_enabled ? local.subscriptions_map : tomap({}) + for_each = local.subscriptions_map_selector[var.module_enabled ? 0 : 1] project = google_pubsub_topic.topic[0].project topic = google_pubsub_topic.topic[0].id