-
Notifications
You must be signed in to change notification settings - Fork 2
/
vpc.tf
69 lines (55 loc) · 1.45 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
resource "aws_vpc" "remotex-vpc" {
cidr_block = "10.10.0.0/16"
enable_dns_hostnames = true
tags = {
Name = "remotex-vpc"
}
}
resource "aws_internet_gateway" "remotex-igw" {
vpc_id = aws_vpc.remotex-vpc.id
tags = {
Name = "remotex-igw"
}
}
resource "aws_subnet" "remotex-pub-sub" {
cidr_block = "10.10.1.0/24"
vpc_id = aws_vpc.remotex-vpc.id
availability_zone = "${var.region}a"
map_public_ip_on_launch = true
tags = {
Name = "remotex-pub-sub"
}
}
resource "aws_subnet" "remotex-pri-sub" {
cidr_block = "10.10.2.0/24"
vpc_id = aws_vpc.remotex-vpc.id
availability_zone = "${var.region}b"
map_public_ip_on_launch = false
tags = {
Name = "remotex-pri-sub"
}
}
resource "aws_route_table" "remotex-pub-rt" {
vpc_id = aws_vpc.remotex-vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.remotex-igw.id
}
tags = {
Name = "remotex-pub-rt"
}
}
resource "aws_route_table" "remotex-pri-rt" {
vpc_id = aws_vpc.remotex-vpc.id
tags = {
Name = "remotex-pri-rt"
}
}
resource "aws_route_table_association" "remotex-pub-rt-asso" {
route_table_id = aws_route_table.remotex-pub-rt.id
subnet_id = aws_subnet.remotex-pub-sub.id
}
resource "aws_route_table_association" "remotex-pri-rt-asso" {
route_table_id = aws_route_table.remotex-pri-rt.id
subnet_id = aws_subnet.remotex-pri-sub.id
}