-
Notifications
You must be signed in to change notification settings - Fork 0
/
subnet.tf
28 lines (22 loc) · 835 Bytes
/
subnet.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
data "aws_availability_zones" "available" {
state = "available"
}
resource "aws_subnet" "some_custom_public_subnet" {
count = var.subnet_count.public
vpc_id = aws_vpc.some_custom_vpc.id
cidr_block = var.public_subnet_cidr_blocks[count.index]
availability_zone = data.aws_availability_zones.available.names[count.index]
map_public_ip_on_launch = true
tags = {
Name = "public_subnet_${count.index}"
}
}
resource "aws_subnet" "some_custom_private_subnet" {
count = var.subnet_count.private
vpc_id = aws_vpc.some_custom_vpc.id
cidr_block = var.private_subnet_cidr_blocks[count.index]
availability_zone = data.aws_availability_zones.available.names[count.index]
tags = {
Name = "private_subnet_${count.index}"
}
}