Skip to content

Commit

Permalink
Add failsafe to local.subnets_to_create in network module
Browse files Browse the repository at this point in the history
  • Loading branch information
chrizkim authored and hyder committed Mar 28, 2024
1 parent e2ac866 commit 9f96c38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/network/subnets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 } : {})
Expand All @@ -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)
Expand Down

0 comments on commit 9f96c38

Please sign in to comment.