Skip to content

Commit

Permalink
Merge pull request #22 from mineiros-io/zied/fix-ternary-logic
Browse files Browse the repository at this point in the history
fix: ternary logic in subscriptions breaks some edge cases
  • Loading branch information
zied-elouaer authored May 24, 2024
2 parents e5dc4b3 + d67b241 commit 3a8c486
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions subscriptions.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3a8c486

Please sign in to comment.