-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc.tf
66 lines (52 loc) · 1.43 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
resource "aws_vpc" "vpc" {
cidr_block = var.vpc_cidr
tags = {
Name = var.vpc_name
}
}
resource "aws_subnet" "public_subnet" {
vpc_id = aws_vpc.vpc.id
cidr_block = var.public_subnet_cidr
availability_zone = "us-east-1a"
tags = {
Name = "${var.vpc_name}-public-subnet"
}
}
resource "aws_subnet" "public_subnet_bckp" {
vpc_id = aws_vpc.vpc.id
cidr_block = var.public_subnet_bckp_cidr
availability_zone = "us-east-1b"
tags = {
Name = "${var.vpc_name}-public-subnet-bckp"
}
}
resource "aws_subnet" "private_subnet" {
vpc_id = aws_vpc.vpc.id
cidr_block = var.private_subnet_cidr
availability_zone = "us-east-1a"
tags = {
Name = "${var.vpc_name}-private-subnet"
}
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.vpc.id
tags = {
Name = "${var.vpc_name}-igw"
}
}
# Route table for public subnet for ports 8089 and 5557
resource "aws_route_table" "public_route_table" {
vpc_id = aws_vpc.vpc.id
tags = {
Name = "${var.vpc_name}-public-route-table"
}
}
resource "aws_route" "public_route" {
route_table_id = aws_route_table.public_route_table.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.igw.id
}
resource "aws_route_table_association" "public_subnet_association" {
subnet_id = aws_subnet.public_subnet.id
route_table_id = aws_route_table.public_route_table.id
}