-
Notifications
You must be signed in to change notification settings - Fork 1
/
route.tf
57 lines (46 loc) · 1.12 KB
/
route.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
resource "aws_route_table" "a" {
vpc_id = "${aws_vpc.a.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.a.id}"
}
route {
cidr_block = "${var.subnets["b"]}"
gateway_id = "${aws_ec2_transit_gateway.lab.id}"
}
route {
cidr_block = "10.0.0.0/8"
gateway_id = "${aws_ec2_transit_gateway.lab.id}"
}
tags {
Name = "lab-rtb-a"
Lab = "aws-route-lab"
}
}
resource "aws_route_table" "b" {
vpc_id = "${aws_vpc.b.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.b.id}"
}
route {
cidr_block = "10.0.0.0/8"
network_interface_id = "${aws_instance.b.network_interface_id}"
}
route {
cidr_block = "${var.subnets["a"]}"
gateway_id = "${aws_ec2_transit_gateway.lab.id}"
}
tags {
Name = "lab-rtb-b"
Lab = "aws-route-lab"
}
}
resource "aws_route_table_association" "a" {
subnet_id = "${aws_subnet.a.id}"
route_table_id = "${aws_route_table.a.id}"
}
resource "aws_route_table_association" "b" {
subnet_id = "${aws_subnet.b.id}"
route_table_id = "${aws_route_table.b.id}"
}