File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,9 @@ resource "aws_route_table_association" "public" {
152
152
}
153
153
154
154
resource "aws_route" "public_internet_gateway" {
155
- count = local. create_public_subnets && var. create_igw ? 1 : 0
155
+ count = local. create_public_subnets && var. create_igw ? length (aws_route_table . public ) : 0
156
156
157
- route_table_id = aws_route_table. public [0 ]. id
157
+ route_table_id = aws_route_table. public [count . index ]. id
158
158
destination_cidr_block = " 0.0.0.0/0"
159
159
gateway_id = aws_internet_gateway. this [0 ]. id
160
160
@@ -164,9 +164,9 @@ resource "aws_route" "public_internet_gateway" {
164
164
}
165
165
166
166
resource "aws_route" "public_internet_gateway_ipv6" {
167
- count = local. create_public_subnets && var. create_igw && var. enable_ipv6 ? 1 : 0
167
+ count = local. create_public_subnets && var. create_igw && var. enable_ipv6 ? length (aws_route_table . public ) : 0
168
168
169
- route_table_id = aws_route_table. public [0 ]. id
169
+ route_table_id = aws_route_table. public [count . index ]. id
170
170
destination_ipv6_cidr_block = " ::/0"
171
171
gateway_id = aws_internet_gateway. this [0 ]. id
172
172
}
You can’t perform that action at this time.
0 commit comments