-
Notifications
You must be signed in to change notification settings - Fork 3
/
subnets.tf
37 lines (28 loc) · 1 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
34
35
36
37
resource "aws_subnet" "websubnets" {
count = var.az_count
vpc_id = aws_vpc.lamp_vpc.id
cidr_block = cidrsubnet(aws_vpc.lamp_vpc.cidr_block, 2, count.index)
availability_zone_id = data.aws_availability_zones.available.zone_ids[count.index]
tags = merge(
{
"Name" : "web-subnet-${count.index}-${terraform.workspace}"
}, var.default_tags)
}
resource "aws_subnet" "dbsubnets" {
count = var.az_count
vpc_id = aws_vpc.lamp_vpc.id
cidr_block = cidrsubnet(aws_vpc.lamp_vpc.cidr_block, 2, count.index + 2)
availability_zone_id = data.aws_availability_zones.available.zone_ids[count.index]
tags = merge(
{
"Name" : "db-subnet-${count.index}-${terraform.workspace}"
}, var.default_tags)
}
resource "aws_db_subnet_group" "databasegroup" {
name = "lampdb"
subnet_ids = aws_subnet.dbsubnets.*.id
tags = merge(
{
"Name" : "db-subnetgroup-${terraform.workspace}"
}, var.default_tags)
}