-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaws-subnets.tf
More file actions
48 lines (41 loc) · 1.08 KB
/
aws-subnets.tf
File metadata and controls
48 lines (41 loc) · 1.08 KB
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
/*
* Internet gateway for the public subnet
*/
resource "aws_internet_gateway" "tithomas-igw1" {
vpc_id = "${aws_vpc.tithomas-vpc1.id}"
tags = {
Name = "tithomas-igw1"
}
}
/*
* Public subnet itself
*/
resource "aws_subnet" "tithomas-sbn-public" {
vpc_id = "${aws_vpc.tithomas-vpc1.id}"
cidr_block = "${var.public_subnet_cidr}"
map_public_ip_on_launch = true
depends_on = ["aws_internet_gateway.tithomas-igw1"]
tags = {
Name = "tithomas-sbn-public"
}
}
/*
* Routing table for the public subnet
*/
resource "aws_route_table" "tithomas-rt1" {
vpc_id = "${aws_vpc.tithomas-vpc1.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.tithomas-igw1.id}"
}
tags = {
Name = "tithomas-rt1"
}
}
/*
* Associate routing table to public subnet
*/
resource "aws_route_table_association" "public" {
subnet_id = "${aws_subnet.tithomas-sbn-public.id}"
route_table_id = "${aws_route_table.tithomas-rt1.id}"
}