From 9f96c38f72409cd56437e73fccf0bc5fb82efd48 Mon Sep 17 00:00:00 2001 From: Christopher Kim Date: Fri, 5 Jan 2024 15:33:44 -0800 Subject: [PATCH] Add failsafe to local.subnets_to_create in network module --- modules/network/subnets.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/network/subnets.tf b/modules/network/subnets.tf index a63780df..c38e5077 100644 --- a/modules/network/subnets.tf +++ b/modules/network/subnets.tf @@ -79,7 +79,7 @@ locals { # - Subnet is configured with newbits and/or netnum/cidr # - Not configured with create == 'never' # - Not configured with an existing 'id' - subnets_to_create = merge( + subnets_to_create = try(merge( { for k, v in local.subnet_info : k => # Override `create = true` if configured with "always" merge(v, lookup(try(lookup(var.subnets, k), { create = "never" }), "create", "auto") == "always" ? { "create" = true } : {}) @@ -92,7 +92,7 @@ locals { ]), ]) } - ) + ), {}) subnet_output = { for k, v in var.subnets : k => lookup(v, "id", null) != null ? v.id : lookup(lookup(oci_core_subnet.oke, k, {}), "id", null)