This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "cidr_ab" { | |
type = map | |
default = { | |
development = "172.22" | |
qa = "172.24" | |
staging = "172.26" | |
production = "172.28" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
private_subnets = [ | |
"${lookup(var.cidr_ab, var.environment)}.1.0/24", | |
"${lookup(var.cidr_ab, var.environment)}.2.0/24", | |
"${lookup(var.cidr_ab, var.environment)}.3.0/24" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "cidr_ab" { | |
type = map | |
default = { | |
development = "172.22" | |
qa = "172.24" | |
staging = "172.26" | |
production = "172.28" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "vpc" { | |
source = "terraform-aws-modules/vpc/aws" | |
version = "~>2.0" | |
name = "my-vpc" | |
cidr = "${lookup(var.cidr_ab, var.environment)}.0.0/16" | |
private_subnets = local.private_subnets | |
database_subnets = local.database_subnets | |
public_subnets = local.public_subnets | |
azs = ["us-west-2a", "us-west-2b", "us-west-2c"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "region" { | |
type = map(string) | |
default = { | |
"development" = "us-west-2" | |
"qa" = "us-east-2" | |
"staging" = "us-east-1" | |
"production" = "ca-central-1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_availability_zones" "available" { | |
state = "available" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
availability_zones = data.aws_availability_zones.available.names | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "cidr_ab" { | |
type = map | |
default = { | |
development = "172.22" | |
qa = "172.24" | |
staging = "172.26" | |
production = "172.28" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "vpc" { | |
source = "terraform-aws-modules/vpc/aws" | |
version = "~>2.0" | |
name = "my-vpc" | |
cidr = "${lookup(var.cidr_ab, var.environment)}.0.0/16" | |
private_subnets = local.private_subnets | |
database_subnets = local.database_subnets | |
public_subnets = local.public_subnets | |
azs = local.availability_zones |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for availability_zone in local.availability_zones: | |
"${lookup(var.cidr_ab, var.environment)}.${local.cidr_c_private_subnets + index_of_availability_zone}.0/24" |
OlderNewer