-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.routes.region2.tf
60 lines (47 loc) · 1.85 KB
/
main.routes.region2.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Add 10/8 route to region2 VPC private route tables
resource "aws_route" "region2_public" {
for_each = var.cloud_vpcs_region2
route_table_id = module.cloud_vpc_region2[each.key].public_route_table_ids[0]
destination_cidr_block = "10.0.0.0/8"
transit_gateway_id = aws_ec2_transit_gateway.tgw_region2.id
timeouts {
create = "5m"
}
provider = aws.secondary
}
# Add 0/0 route to region2 VPC private route tables
resource "aws_route" "region2_private_default_0" {
for_each = var.cloud_vpcs_region2
route_table_id = module.cloud_vpc_region2[each.key].private_route_table_ids[0]
destination_cidr_block = "0.0.0.0/0"
transit_gateway_id = aws_ec2_transit_gateway.tgw_region2.id
timeouts {
create = "5m"
}
provider = aws.secondary
}
resource "aws_route" "region2_private_default_1" {
for_each = var.cloud_vpcs_region2
route_table_id = module.cloud_vpc_region2[each.key].private_route_table_ids[1]
destination_cidr_block = "0.0.0.0/0"
transit_gateway_id = aws_ec2_transit_gateway.tgw_region2.id
timeouts {
create = "5m"
}
provider = aws.secondary
}
# # Add 10/8 to region2 OnPrem Public route tables, point to the StrongWAN gateway
resource "aws_route" "region2_public_vpn_gw" {
route_table_id = module.onprem_vpc_region2.public_route_table_ids[0]
destination_cidr_block = "10.0.0.0/8"
network_interface_id = aws_cloudformation_stack.region2_vpn_gateway.outputs.NicID
provider = aws.secondary
}
# # Add 0/0 to region2 OnPrem private route tables, point to the StrongWAN gateway
resource "aws_route" "region2_private_vpn_gw" {
count = 2
route_table_id = module.onprem_vpc_region2.private_route_table_ids[count.index]
destination_cidr_block = "0.0.0.0/0"
network_interface_id = aws_cloudformation_stack.region2_vpn_gateway.outputs.NicID
provider = aws.secondary
}