File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ locals {
15
15
for rtb_id in try (v. vpc_route_table_ids , []) : {
16
16
rtb_id = rtb_id
17
17
cidr = v . tgw_destination_cidr
18
+ tgw_id = var . create_tgw ? aws_ec2_transit_gateway . this [0 ]. id : v . tgw_id
18
19
}
19
20
]
20
21
])
@@ -110,11 +111,14 @@ resource "aws_ec2_transit_gateway_route" "this" {
110
111
}
111
112
112
113
resource "aws_route" "this" {
113
- for_each = { for x in local . vpc_route_table_destination_cidr : x . rtb_id => x . cidr }
114
+ for_each = { for x in local . vpc_route_table_destination_cidr : x . rtb_id => {
115
+ cidr = x.cidr,
116
+ tgw_id = x.tgw_id
117
+ } }
114
118
115
119
route_table_id = each. key
116
- destination_cidr_block = each. value
117
- transit_gateway_id = aws_ec2_transit_gateway . this [ 0 ] . id
120
+ destination_cidr_block = each. value [ " cidr " ]
121
+ transit_gateway_id = each . value [ " tgw_id " ]
118
122
}
119
123
120
124
resource "aws_ec2_transit_gateway_route_table_association" "this" {
You can’t perform that action at this time.
0 commit comments