-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutetable.tf
37 lines (30 loc) · 939 Bytes
/
routetable.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
resource "aws_route_table" "public-subnet" {
vpc_id = "${aws_vpc.default.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.default.id}"
}
tags {
Name = "Lab Public Subnet"
}
}
resource "aws_route_table_association" "public-subnet" {
count = "${length(split(",", lookup(var.azs, var.region)))}"
subnet_id = "${element(aws_subnet.public-subnet.*.id, count.index)}"
route_table_id = "${aws_route_table.public-subnet.id}"
}
resource "aws_route_table" "private-subnet" {
vpc_id = "${aws_vpc.default.id}"
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = "${aws_nat_gateway.nat.id}"
}
tags {
Name = "Lab Private Subnet"
}
}
resource "aws_route_table_association" "private-subnet" {
count = "${length(split(",", lookup(var.azs, var.region)))}"
subnet_id = "${element(aws_subnet.private-subnet.*.id, count.index)}"
route_table_id = "${aws_route_table.private-subnet.id}"
}