Skip to content

Commit

Permalink
fix: replace zipmap in subnet_detail_map output (terraform-ibm-module…
Browse files Browse the repository at this point in the history
…s#449)

Co-authored-by: imprateeksh <[email protected]>
  • Loading branch information
2 people authored and gmendel committed Mar 29, 2023
1 parent 7304543 commit 6ca94ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions module-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
"description": "List of shortnames and IDs of network ACLs",
"pos": {
"filename": "outputs.tf",
"line": 91
"line": 105
}
},
"public_gateways": {
Expand Down Expand Up @@ -436,7 +436,7 @@
"description": "Details of VPC flow logs collector",
"pos": {
"filename": "outputs.tf",
"line": 108
"line": 122
}
},
"vpc_id": {
Expand Down
16 changes: 15 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,22 @@ output "subnet_zone_list" {

output "subnet_detail_map" {
description = "A map of subnets containing IDs, CIDR blocks, and zones"
value = zipmap([for prefix, _ in var.address_prefixes : prefix], [for subnet in ibm_is_subnet.subnet : [{ id = subnet.id, zone = subnet.zone, cidr_block = subnet.ipv4_cidr_block }]])
value = {
for zone_name in distinct([
for subnet in ibm_is_subnet.subnet :
subnet.zone
]) :
"zone-${substr(zone_name, -1, length(zone_name))}" => [
for subnet in ibm_is_subnet.subnet :
{
id = subnet.id
zone = subnet.zone
cidr_block = subnet.ipv4_cidr_block
} if subnet.zone == zone_name
]
}
}

##############################################################################

##############################################################################
Expand Down

0 comments on commit 6ca94ba

Please sign in to comment.