Skip to content

Instantly share code, notes, and snippets.

@FernandoMiguel
Created February 7, 2022 12:29
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 FernandoMiguel/fdaaa3983491cbc31cb5c3ba3880bccd to your computer and use it in GitHub Desktop.
Save FernandoMiguel/fdaaa3983491cbc31cb5c3ba3880bccd to your computer and use it in GitHub Desktop.
here’s how simple it is to avoid putting resources from the bad us-east1 AZ
data "aws_availability_zones" "good_zone_ids" {
exclude_zone_ids = [
# There are no modern instance types in use1-az3; AWS has left
# that zone behind for the most part. See, for example, here:
# https://www.reddit.com/r/aws/comments/g5lh7h/t3m5r5_instance_types_in_use1az3/
"use1-az3",
]
state = "available"
}
output "good_zone_ids" { value = data.aws_availability_zones.good_zone_ids }
data "aws_subnet_ids" "private_subnets" {
vpc_id = data.aws_vpc.vpc_id.id
filter {
name = "tag:Name"
values = var.subnet_filter
}
filter {
name = "availability-zone-id"
values = data.aws_availability_zones.good_zone_ids.zone_ids
}
}
output "private_subnets" { value = data.aws_subnet_ids.private_subnets }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment