From e2e5ce7bdaf576446007acf9bde90cda8e3af288 Mon Sep 17 00:00:00 2001 From: Daniel Andrade Date: Tue, 26 Nov 2024 09:42:17 -0300 Subject: [PATCH] fix: fail gracefully if ingress.to.operations index does not exist --- modules/regular_service_perimeter/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/regular_service_perimeter/main.tf b/modules/regular_service_perimeter/main.tf index e9fb470..68bcef4 100644 --- a/modules/regular_service_perimeter/main.tf +++ b/modules/regular_service_perimeter/main.tf @@ -54,7 +54,7 @@ resource "google_access_context_manager_service_perimeter" "regular_service_peri ingress_to { resources = lookup(ingress_policies.value["to"], "resources", ["*"]) dynamic "operations" { - for_each = ingress_policies.value["to"]["operations"] + for_each = lookup(ingress_policies.value["to"], "operations", []) content { service_name = operations.key dynamic "method_selectors" { @@ -149,7 +149,7 @@ resource "google_access_context_manager_service_perimeter" "regular_service_peri ingress_to { resources = lookup(ingress_policies_dry_run.value["to"], "resources", ["*"]) dynamic "operations" { - for_each = ingress_policies_dry_run.value["to"]["operations"] + for_each = lookup(ingress_policies_dry_run.value["to"], "operations", []) content { service_name = operations.key dynamic "method_selectors" {