2020-06-18 10:30:49 +08:00
|
|
|
data "aws_availability_zones" "available" {}
|
|
|
|
|
2020-06-28 16:14:23 +08:00
|
|
|
#resource "random_string" "suffix" {
|
|
|
|
# length = 4
|
|
|
|
# special = false
|
|
|
|
#}
|
|
|
|
|
|
|
|
resource "random_integer" "suffix" {
|
|
|
|
min = 1000
|
|
|
|
max = 9999
|
2020-06-18 10:30:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module "vpc" {
|
|
|
|
source = "terraform-aws-modules/vpc/aws"
|
|
|
|
version = "2.6.0"
|
|
|
|
|
2020-06-28 16:14:23 +08:00
|
|
|
name = "demo-vpc-${random_integer.suffix.result}"
|
2020-06-18 10:30:49 +08:00
|
|
|
cidr = "172.16.0.0/16"
|
|
|
|
azs = data.aws_availability_zones.available.names
|
|
|
|
private_subnets = ["172.16.1.0/24", "172.16.2.0/24", "172.16.3.0/24"]
|
|
|
|
public_subnets = ["172.16.4.0/24", "172.16.5.0/24", "172.16.6.0/24"]
|
|
|
|
enable_nat_gateway = true
|
|
|
|
single_nat_gateway = true
|
|
|
|
enable_dns_hostnames = true
|
|
|
|
|
|
|
|
tags = {
|
|
|
|
"owner" = "KF"
|
|
|
|
"terraform" = "initial-deployment-only"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|