-
Notifications
You must be signed in to change notification settings - Fork 1
/
vpc.tf
44 lines (39 loc) · 947 Bytes
/
vpc.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
# Define a vpc
resource "aws_vpc" "demoVPC" {
cidr_block = "200.0.0.0/16"
tags {
Name = "ecsDemoVPC"
}
}
# Internet gateway for the public subnet
resource "aws_internet_gateway" "demoIG" {
vpc_id = "${aws_vpc.demoVPC.id}"
tags {
Name = "ecsDemoIG"
}
}
# Public subnet
resource "aws_subnet" "demoPubSN0-0" {
vpc_id = "${aws_vpc.demoVPC.id}"
cidr_block = "200.0.0.0/24"
availability_zone = "us-east-1a"
tags {
Name = "ecsDemoPubSN0-0-0"
}
}
# Routing table for public subnet
resource "aws_route_table" "demoPubSN0-0RT" {
vpc_id = "${aws_vpc.demoVPC.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.demoIG.id}"
}
tags {
Name = "demoPubSN0-0RT"
}
}
# Associate the routing table to public subnet
resource "aws_route_table_association" "demoPubSN0-0RTAssn" {
subnet_id = "${aws_subnet.demoPubSN0-0.id}"
route_table_id = "${aws_route_table.demoPubSN0-0RT.id}"
}