Skip to content

Instantly share code, notes, and snippets.

@unfor19
Created September 24, 2019 08:59
Show Gist options
  • Save unfor19/a48f350d6cad3d3bd3ae38b0897faee7 to your computer and use it in GitHub Desktop.
Save unfor19/a48f350d6cad3d3bd3ae38b0897faee7 to your computer and use it in GitHub Desktop.
Issue #1: 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"
]
}
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