-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
51 lines (43 loc) · 1.32 KB
/
main.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
46
47
48
49
50
51
module "subnets" {
source = "hashicorp/subnets/cidr"
version = "1.0.0"
base_cidr_block = var.cidr
networks = flatten([
for k, v in local.subnets : [
for az in var.azs : {
name = "${k}-${az}"
new_bits = v
}
]
])
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.1.1"
azs = var.azs
cidr = var.cidr
database_subnets = [for az in var.azs : module.subnets.network_cidr_blocks["database-${az}"]]
elasticache_subnets = [for az in var.azs : module.subnets.network_cidr_blocks["elasticache-${az}"]]
enable_nat_gateway = true
intra_subnets = [for az in var.azs : module.subnets.network_cidr_blocks["intra-${az}"]]
name = var.name
one_nat_gateway_per_az = false
private_subnets = [for az in var.azs : module.subnets.network_cidr_blocks["private-${az}"]]
public_subnets = [for az in var.azs : module.subnets.network_cidr_blocks["public-${az}"]]
single_nat_gateway = true
default_security_group_ingress = [
{
self = true
}
]
private_subnet_tags = {
"kubernetes.io/role/internal-elb" = 1
}
public_subnet_tags = {
"kubernetes.io/role/elb" = 1
}
tags = {
Network = var.name
Terraform = "terraform-aws-network"
}
}