forked from iaasweek/terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subnets.tf
25 lines (22 loc) · 780 Bytes
/
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
# Criar subnet public para cada AZ
resource "aws_subnet" "private" {
count = var.az_count
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)
availability_zone = data.aws_availability_zones.available.names[count.index]
vpc_id = aws_vpc.main.id
tags = {
Name = "Private"
}
}
# Criar subnet public para cada AZ
resource "aws_subnet" "public" {
count = var.az_count
# var.az_count é usado para não conflitar com o private
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, var.az_count + count.index)
availability_zone = data.aws_availability_zones.available.names[count.index]
vpc_id = aws_vpc.main.id
map_public_ip_on_launch = true
tags = {
Name = "Public"
}
}