-
Notifications
You must be signed in to change notification settings - Fork 14
/
subnets.tf
33 lines (28 loc) · 1.19 KB
/
subnets.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
resource "aws_subnet" "public_subnet_a" {
vpc_id = aws_vpc.cluster_vpc.id
cidr_block = "12.0.16.0/20"
map_public_ip_on_launch = true
availability_zone = format("%sa", var.aws_region)
tags = merge(var.tags, {
Name = format("%s-public-%sa", var.project_name, var.aws_region)
})
}
# Associate subnet public_subnet_cluster_1a to public route table
resource "aws_route_table_association" "public_subnet_cluster_1a_association" {
subnet_id = aws_subnet.public_subnet_a.id
route_table_id = aws_vpc.cluster_vpc.main_route_table_id
}
resource "aws_subnet" "public_subnet_b" {
vpc_id = aws_vpc.cluster_vpc.id
cidr_block = "12.0.32.0/20"
map_public_ip_on_launch = true
availability_zone = format("%sb", var.aws_region)
tags = merge(var.tags, {
Name = format("%s-public-%sb", var.project_name, var.aws_region)
})
}
# Associate subnet public_subnet_cluster_1b to public route table
resource "aws_route_table_association" "public_subnet_cluster_1b_association" {
subnet_id = aws_subnet.public_subnet_b.id
route_table_id = aws_vpc.cluster_vpc.main_route_table_id
}