2016-05-14 20:18:51 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
|
|
|
page_title: "AWS: aws_availability_zones"
|
|
|
|
sidebar_current: "docs-aws-datasource-availability-zones"
|
|
|
|
description: |-
|
2016-08-05 02:14:05 +02:00
|
|
|
Provides a list of Availability Zones which can be used by an AWS account.
|
2016-05-14 20:18:51 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
2016-05-22 19:21:02 +02:00
|
|
|
This is different from the `aws_availability_zone` (singular) data source,
|
|
|
|
which provides some details about a specific availability zone.
|
|
|
|
|
2016-05-14 20:18:51 +02:00
|
|
|
## Example Usage
|
|
|
|
|
2017-04-07 17:54:28 +02:00
|
|
|
```hcl
|
2016-05-14 20:18:51 +02:00
|
|
|
# Declare the data source
|
2016-06-15 15:17:12 +02:00
|
|
|
data "aws_availability_zones" "available" {}
|
2016-05-14 20:18:51 +02:00
|
|
|
|
2016-06-15 15:17:12 +02:00
|
|
|
# e.g. Create subnets in the first two available availability zones
|
2016-05-14 20:18:51 +02:00
|
|
|
|
2016-06-15 15:17:12 +02:00
|
|
|
resource "aws_subnet" "primary" {
|
|
|
|
availability_zone = "${data.aws_availability_zones.available.names[0]}"
|
|
|
|
|
2017-04-06 20:06:48 +02:00
|
|
|
# ...
|
2016-06-15 15:17:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_subnet" "secondary" {
|
|
|
|
availability_zone = "${data.aws_availability_zones.available.names[1]}"
|
|
|
|
|
2017-04-06 20:06:48 +02:00
|
|
|
# ...
|
2016-05-14 20:18:51 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
2016-08-05 02:14:05 +02:00
|
|
|
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.
|
2016-05-14 20:18:51 +02:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
2016-08-05 02:14:05 +02:00
|
|
|
* `names` - A list of the Availability Zone names available to the account.
|