We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ff32c7 commit c81be4cCopy full SHA for c81be4c
vpc-endpoint-s3.tf
@@ -21,7 +21,10 @@ resource "aws_vpc_endpoint" "s3" {
21
}
22
23
resource "aws_vpc_endpoint_route_table_association" "private" {
24
- count = var.vpc_endpoint_s3_gateway ? length(aws_subnet.private) : 0
25
- route_table_id = var.multi_nat ? aws_route_table.private[count.index].id : aws_route_table.private[0].id
+ for_each = var.vpc_endpoint_s3_gateway ? {
+ for idx, subnet in aws_subnet.private : idx => subnet
26
+ } : {}
27
+
28
+ route_table_id = var.multi_nat || var.multi_az_private_rtb ? aws_route_table.private[each.key].id : aws_route_table.private[0].id
29
vpc_endpoint_id = aws_vpc_endpoint.s3[0].id
-}
30
+}
0 commit comments