Skip to content

Commit 9f96c38

Browse files
chrizkimhyder
authored andcommitted
Add failsafe to local.subnets_to_create in network module
1 parent e2ac866 commit 9f96c38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/network/subnets.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ locals {
7979
# - Subnet is configured with newbits and/or netnum/cidr
8080
# - Not configured with create == 'never'
8181
# - Not configured with an existing 'id'
82-
subnets_to_create = merge(
82+
subnets_to_create = try(merge(
8383
{ for k, v in local.subnet_info : k =>
8484
# Override `create = true` if configured with "always"
8585
merge(v, lookup(try(lookup(var.subnets, k), { create = "never" }), "create", "auto") == "always" ? { "create" = true } : {})
@@ -92,7 +92,7 @@ locals {
9292
]),
9393
])
9494
}
95-
)
95+
), {})
9696

9797
subnet_output = { for k, v in var.subnets :
9898
k => lookup(v, "id", null) != null ? v.id : lookup(lookup(oci_core_subnet.oke, k, {}), "id", null)

0 commit comments

Comments
 (0)