forked from stlrda/Airflow-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc.tf
45 lines (39 loc) · 1.2 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
resource "aws_vpc" "airflow_vpc" {
cidr_block = "172.16.0.0/20"
tags = var.tags
enable_dns_hostnames = true
}
resource "aws_internet_gateway" "airflow_gateway" {
vpc_id = aws_vpc.airflow_vpc.id
tags = var.tags
}
resource "aws_route_table" "airflow_route_table" {
vpc_id = aws_vpc.airflow_vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.airflow_gateway.id
}
tags = var.tags
}
resource "aws_subnet" "airflow_subnet_a" {
vpc_id = aws_vpc.airflow_vpc.id
cidr_block = "172.16.0.0/27"
tags = var.tags
availability_zone = "${var.aws_region}a"
map_public_ip_on_launch = true
}
resource "aws_subnet" "airflow_subnet_b" {
vpc_id = aws_vpc.airflow_vpc.id
cidr_block = "172.16.0.32/27"
tags = var.tags
availability_zone = "${var.aws_region}b"
map_public_ip_on_launch = true
}
resource "aws_route_table_association" "airflow_subnet_a_route_table" {
subnet_id = aws_subnet.airflow_subnet_a.id
route_table_id = aws_route_table.airflow_route_table.id
}
resource "aws_route_table_association" "airflow_subnet_b_route_table" {
subnet_id = aws_subnet.airflow_subnet_b.id
route_table_id = aws_route_table.airflow_route_table.id
}