Provides information about AWS Regions. Can be used to filter regions i.e., by Opt-In status or only regions enabled for current account. To get details like endpoint and description of each region the data source can be combined with the aws_region
data source.
Enabled AWS Regions:
data "aws_regions" "current" {}
All the regions regardless of the availability
data "aws_regions" "current" {
all_regions = true
}
To see regions that are filtered by "not-opted-in"
, the all_regions
argument needs to be set to true
or no results will be returned.
data "aws_regions" "current" {
all_regions = true
filter {
name = "opt-in-status"
values = ["not-opted-in"]
}
}
This data source supports the following arguments:
all_regions
- (Optional) If true the source will query all regions regardless of availability.
filter
- (Optional) Configuration block(s) to use as filters. Detailed below.
The filter
configuration block supports the following arguments:
name
- (Required) Name of the filter field. Valid values can be found in the describe-regions AWS CLI Reference.values
- (Required) Set of values that are accepted for the given filter field. Results will be selected if any given value matches.This data source exports the following attributes in addition to the arguments above:
id
- Identifier of the current partition (e.g., aws
in AWS Commercial, aws-cn
in AWS China).names
- Names of regions that meets the criteria.