mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-17 22:00:45 -04:00
* Add state filter to aws_availability_zones data source. This commit adds an ability to filter Availability Zones based on state, where by default it would only list available zones. Be advised that this does not always works reliably for an older accounts which have been created in the pre-VPC era of EC2. These accounts tends to retrieve availability zones that are not VPC-enabled, thus creation of a custom subnet within such Availability Zone would result in a failure. Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> * Update documentation for aws_availability_zones data source. Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> * Do not filter on state by default. This commit makes the state filter applicable only when set. Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
1.4 KiB
1.4 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| aws | AWS: aws_availability_zones | docs-aws-datasource-availability-zones | Provides a list of Availability Zones which can be used by an AWS account. |
aws_availability_zones
The Availability Zones data source allows access to the list of AWS Availability Zones which can be accessed by an AWS account within the region configured in the provider.
Example Usage
# Declare the data source
data "aws_availability_zones" "available" {}
# e.g. Create subnets in the first two available availability zones
resource "aws_subnet" "primary" {
availability_zone = "${data.aws_availability_zones.available.names[0]}"
# Other properties...
}
resource "aws_subnet" "secondary" {
availability_zone = "${data.aws_availability_zones.available.names[1]}"
# Other properties...
}
Argument Reference
The following arguments are supported:
state- (Optional) Allows to filter list of Availability Zones based on their current state. Can be either"available","information","impaired"or"unavailable". By default the list includes a complete set of Availability Zones to which the underlying AWS account has access, regardless of their state.
Attributes Reference
The following attributes are exported:
names- A list of the Availability Zone names available to the account.