terraform-community-modules / tf_aws_vpc

[DEPRECATED] Use https://github.com/terraform-aws-modules/terraform-aws-vpc
Other
210 stars 203 forks source link

Support aws_availability_zones #37

Closed analytically closed 7 years ago

analytically commented 7 years ago

See https://github.com/hashicorp/terraform/pull/11482

data "aws_availability_zones" "available" {}

resource "aws_subnet" "public" {
  count = "${length(data.aws_availability_zones.available.id)}"
  availability_zone = "${data.aws_availability_zones.available.id[count.index]}"
}
nyambati commented 7 years ago

@analytically I think you can still use the module as is with aws_availability_zones. This module requires a list of azs to create subnets. You can supply that list to the module, here is an example.

module "vpc" {
...
  azs                = ["${data.aws_availability_zones.available.names}"]
...
}

I think the current setup makes the module more flexible providing more control on how many subnets you would like to create.

analytically commented 7 years ago

Thanks!