Skip to content

aws.ec2-availability-zones data source

Description

AvailabilityZones looks up the Availability Zones, Local Zones, and Wavelength Zones for the configured Region with DescribeAvailabilityZones. Three inputs reach AWS: all-availability-zones widens the result to every zone regardless of opt-in status, state becomes a state filter, and filters passes generic name/values filters straight through. exclude-names and exclude-zone-ids act client-side after the call, skipping the named zones from the projection. The lookup errors when no zone survives the projection rather than returning empty lists.

The three output lists are positionally aligned: names is sorted ascending by zone name, and zone-ids holds each zone's id at the same index as its name, so the same index in either list refers to the same zone. group-names is a separate, deduplicated, sorted list and is not index-aligned with the others.

Source: internal/service/ec2/availability_zones_dsrc.go:31

Example usage:

imports: {
  aws: 'github.com/cloudboss/unobin-library-aws'
}

data-sources: {
  example: aws.ec2-availability-zones {
    # Set input fields here.
  }
}

Inputs

all-availability-zones

optional(boolean)

state

optional(string)

filters

list(object)
list(
  object({
    name: string
    values: list(string)
  })
)

exclude-names

list(string)

exclude-zone-ids

list(string)

Input Constraints

State rules

state must be one of available, information, impaired, unavailable, or constrained.

Rule logic
When
input.state != null
Require
input.state == 'available'
|| input.state == 'information'
|| input.state == 'impaired'
|| input.state == 'unavailable'
|| input.state == 'constrained'

Outputs

names

list(string)

zone-ids

list(string)

group-names

list(string)