diff options
Diffstat (limited to 'photo.jinwei.me/infra/vpc.tf')
-rw-r--r-- | photo.jinwei.me/infra/vpc.tf | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/photo.jinwei.me/infra/vpc.tf b/photo.jinwei.me/infra/vpc.tf new file mode 100644 index 0000000..0776178 --- /dev/null +++ b/photo.jinwei.me/infra/vpc.tf | |||
@@ -0,0 +1,29 @@ | |||
1 | locals { | ||
2 | cidr_block = "10.31.0.0/16" | ||
3 | subnets = cidrsubnets(local.cidr_block, 4, 4, 4, 4, 4, 4) | ||
4 | subnet_groups = chunklist(local.subnets, 3) | ||
5 | } | ||
6 | |||
7 | module "vpc" { | ||
8 | source = "terraform-aws-modules/vpc/aws" | ||
9 | version = "3.18.1" | ||
10 | |||
11 | name = local.name | ||
12 | cidr = local.cidr_block | ||
13 | azs = data.aws_availability_zones.available.names | ||
14 | private_subnets = local.subnet_groups[0] | ||
15 | public_subnets = local.subnet_groups[1] | ||
16 | enable_dns_hostnames = true | ||
17 | enable_dns_support = true | ||
18 | enable_nat_gateway = false | ||
19 | single_nat_gateway = true | ||
20 | } | ||
21 | |||
22 | resource "aws_db_subnet_group" "jinwei-me" { | ||
23 | name = var.name | ||
24 | subnet_ids = module.vpc.public_subnets | ||
25 | |||
26 | tags = { | ||
27 | Name = var.name | ||
28 | } | ||
29 | } | ||