Skip to content

Instantly share code, notes, and snippets.

@unfor19
Created September 24, 2019 09:06
Show Gist options
  • Save unfor19/d59faf08130055f23f2ad15f837633ba to your computer and use it in GitHub Desktop.
Save unfor19/d59faf08130055f23f2ad15f837633ba to your computer and use it in GitHub Desktop.
Issue #2: Full solution
variable "cidr_ab" {
type = map
default = {
development = "172.22"
qa = "172.24"
staging = "172.26"
production = "172.28"
}
}
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"
]
database_subnets = [
"${lookup(var.cidr_ab, var.environment)}.11.0/24",
"${lookup(var.cidr_ab, var.environment)}.12.0/24",
"${lookup(var.cidr_ab, var.environment)}.13.0/24"
]
public_subnets = [
"${lookup(var.cidr_ab, var.environment)}.64.0/24",
"${lookup(var.cidr_ab, var.environment)}.65.0/24",
"${lookup(var.cidr_ab, var.environment)}.66.0/24"
]
}
data "aws_availability_zones" "available" {
state = "available"
}
locals {
availability_zones = data.aws_availability_zones.available.names
}
variable "environment" {
type = string
description = "Options: development, qa, staging, production"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment