Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Last active October 28, 2016 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matschaffer/a3707be5bdc6de60fbbd50710d4f4644 to your computer and use it in GitHub Desktop.
Save matschaffer/a3707be5bdc6de60fbbd50710d4f4644 to your computer and use it in GitHub Desktop.
data "aws_vpc" "common" {
filter {
name = "tag:Name"
values = ["common"]
}
}
data "aws_subnet" "common" {
count = "${var.availability_zone_count}"
vpc_id = "${data.aws_vpc.common.id}"
availability_zone = "${element(module.region_variables.availability_zones, count.index)}"
}
resource "aws_autoscaling_group" "main" {
...
availability_zones = ["${data.aws_subnet.common.*.availability_zone}"]
vpc_zone_identifier = ["${data.aws_subnet.common.*.id}"]
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment