Skip to content

Commit b34804e

Browse files
author
Sean Sundberg
authored
Adds zone to subnet outputs (#10)
Signed-off-by: Sean Sundberg <[email protected]>
1 parent 87b5250 commit b34804e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ resource ibm_is_subnet vpc_subnet {
9494
network_acl = ibm_is_network_acl.network_acl.id
9595
}
9696

97+
data ibm_is_subnet vpc_subnet {
98+
count = local.subnet_count
99+
100+
identifier = ibm_is_subnet.vpc_subnet[count.index].id
101+
}
102+
97103
resource ibm_is_security_group_rule rule_tcp_k8s {
98104
count = local.subnet_count
99105

outputs.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ output "subnet_ids" {
3535

3636
output "subnets" {
3737
value = [
38-
for subnet in ibm_is_subnet.vpc_subnet:
38+
for subnet in data.ibm_is_subnet.vpc_subnet:
3939
{
4040
id = subnet.id
41-
label = length(var.subnets) > 0 ? var.subnets[index(ibm_is_subnet.vpc_subnet, subnet)].label : "default"
41+
zone = subnet.zone
42+
label = length(var.subnets) > 0 ? element(var.subnets, index(data.ibm_is_subnet.vpc_subnet[*].id, subnet.id)).label : "default"
4243
}
4344
]
4445
depends_on = [ibm_is_subnet.vpc_subnet]

0 commit comments

Comments
 (0)