Skip to content

Commit bbfb6a9

Browse files
committed
Update route-table
1 parent 7b301fe commit bbfb6a9

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

modules/route-table/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ resource "aws_main_route_table_association" "this" {
5959
# Associations
6060
###################################################
6161

62-
# INFO: Conflict on create with `for_each`
6362
resource "aws_route_table_association" "subnets" {
6463
count = length(var.subnets)
6564

@@ -68,10 +67,10 @@ resource "aws_route_table_association" "subnets" {
6867
}
6968

7069
resource "aws_route_table_association" "gateways" {
71-
for_each = toset(var.gateways)
70+
count = length(var.gateways)
7271

7372
route_table_id = aws_route_table.this.id
74-
gateway_id = each.value
73+
gateway_id = var.gateways[count.index]
7574
}
7675

7776

modules/route-table/outputs.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ output "associated_subnets" {
109109

110110
output "associated_gateways" {
111111
description = "A list of gateway IDs which is associated with the route table."
112-
value = values(aws_route_table_association.gateways)[*].gateway_id
112+
value = aws_route_table_association.gateways[*].gateway_id
113113
}
114114

115115
output "associated_vpc_gateway_endpoints" {
@@ -121,4 +121,3 @@ output "propagated_vpn_gateways" {
121121
description = "A list of Virtual Private Gateway IDs which propagate routes from."
122122
value = values(aws_vpn_gateway_route_propagation.this)[*].vpn_gateway_id
123123
}
124-

0 commit comments

Comments
 (0)