Last active
March 19, 2018 19:55
-
-
Save santiagopoli/44c495de846a36690207ecafda8bc921 to your computer and use it in GitHub Desktop.
Terraform Blue Green / Subnets
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 { | |
subnet_count = 3 | |
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] | |
} | |
resource "aws_subnet" "terraform-blue-green" { | |
count = "${local.subnet_count}" | |
vpc_id = "${var.vpc_id}" | |
availability_zone = "${element(local.availability_zones, count.index)}" | |
cidr_block = "10.0.${local.subnet_count * (var.infrastructure_version - 1) + count.index + 1}.0/24" | |
map_public_ip_on_launch = true | |
tags { | |
Name = "${element(local.availability_zones, count.index)} (v${var.infrastructure_version})" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment