File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ module "tgw_peer" {
104
104
transit_gateway_default_route_table_association = false
105
105
transit_gateway_default_route_table_propagation = false
106
106
107
+ vpc_route_table_ids = module.vpc1.private_route_table_ids
108
+ tgw_destination_cidr = " 0.0.0.0/0"
109
+
107
110
tgw_routes = [
108
111
{
109
112
destination_cidr_block = " 30.0.0.0/16"
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