GetAvailabilityZone
aws.getAvailabilityZone provides details about a specific availability zone (AZ)
in the current region.
This can be used both to validate an availability zone given in a variable and to split the AZ name into its component parts of an AWS region and an AZ identifier letter. The latter may be useful e.g. for implementing a consistent subnet numbering scheme across several regions by mapping both the region and the subnet letter to network numbers.
This is different from the aws.getAvailabilityZones (plural) data source,
which provides a list of the available zones.
Example Usage
Coming soon!
Coming soon!
Coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const regionNumber = config.get("regionNumber") || {
"ap-northeast-1": 5,
"eu-central-1": 4,
"us-east-1": 1,
"us-west-1": 2,
"us-west-2": 3,
};
const azNumber = config.get("azNumber") || {
a: 1,
b: 2,
c: 3,
d: 4,
e: 5,
f: 6,
};
// Retrieve the AZ where we want to create network resources
// This must be in the region selected on the AWS provider.
const exampleAvailabilityZone = pulumi.output(aws.getAvailabilityZone({
name: "eu-central-1a",
}, { async: true }));
// Create a VPC for the region associated with the AZ
const exampleVpc = new aws.ec2.Vpc("example", {
cidrBlock: exampleAvailabilityZone.apply(exampleAvailabilityZone => (() => {
throw "tf2pulumi error: NYI: call to cidrsubnet";
return (() => { throw "NYI: call to cidrsubnet"; })();
})()),
});
// Create a subnet for the AZ within the regional VPC
const exampleSubnet = new aws.ec2.Subnet("example", {
cidrBlock: pulumi.all([exampleVpc.cidrBlock, exampleAvailabilityZone]).apply(([cidrBlock, exampleAvailabilityZone]) => (() => {
throw "tf2pulumi error: NYI: call to cidrsubnet";
return (() => { throw "NYI: call to cidrsubnet"; })();
})()),
vpcId: exampleVpc.id,
});Using GetAvailabilityZone
function getAvailabilityZone(args: GetAvailabilityZoneArgs, opts?: InvokeOptions): Promise<GetAvailabilityZoneResult>function get_availability_zone(all_availability_zones=None, filters=None, name=None, state=None, zone_id=None, opts=None)func GetAvailabilityZone(ctx *Context, args *GetAvailabilityZoneArgs, opts ...InvokeOption) (*GetAvailabilityZoneResult, error)public static class GetAvailabilityZone {
public static Task<GetAvailabilityZoneResult> InvokeAsync(GetAvailabilityZoneArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- All
Availability boolZones Set to
trueto include all Availability Zones and Local Zones regardless of your opt in status.- Filters
List<Get
Availability Zone Filter Args> Configuration block(s) for filtering. Detailed below.
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- State string
A specific availability zone state to require. May be any of
"available","information"or"impaired".- Zone
Id string The zone ID of the availability zone to select.
- All
Availability boolZones Set to
trueto include all Availability Zones and Local Zones regardless of your opt in status.- Filters
[]Get
Availability Zone Filter Configuration block(s) for filtering. Detailed below.
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- State string
A specific availability zone state to require. May be any of
"available","information"or"impaired".- Zone
Id string The zone ID of the availability zone to select.
- all
Availability booleanZones Set to
trueto include all Availability Zones and Local Zones regardless of your opt in status.- filters
Get
Availability Zone Filter[] Configuration block(s) for filtering. Detailed below.
- name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- state string
A specific availability zone state to require. May be any of
"available","information"or"impaired".- zone
Id string The zone ID of the availability zone to select.
- all_
availability_ boolzones Set to
trueto include all Availability Zones and Local Zones regardless of your opt in status.- filters
List[Get
Availability Zone Filter] Configuration block(s) for filtering. Detailed below.
- name str
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- state str
A specific availability zone state to require. May be any of
"available","information"or"impaired".- zone_
id str The zone ID of the availability zone to select.
GetAvailabilityZone Result
The following output properties are available:
- Group
Name string For Availability Zones, this is the same value as the Region name. For Local Zones, the name of the associated group, for example
us-west-2-lax-1.- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Name
Suffix string The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.
- Network
Border stringGroup The name of the location from which the address is advertised.
- Opt
In stringStatus For Availability Zones, this always has the value of
opt-in-not-required. For Local Zones, this is the opt in status. The possible values areopted-inandnot-opted-in.- Region string
The region where the selected availability zone resides. This is always the region selected on the provider, since this data source searches only within that region.
- State string
- Zone
Id string - All
Availability boolZones - Filters
List<Get
Availability Zone Filter>
- Group
Name string For Availability Zones, this is the same value as the Region name. For Local Zones, the name of the associated group, for example
us-west-2-lax-1.- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Name
Suffix string The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.
- Network
Border stringGroup The name of the location from which the address is advertised.
- Opt
In stringStatus For Availability Zones, this always has the value of
opt-in-not-required. For Local Zones, this is the opt in status. The possible values areopted-inandnot-opted-in.- Region string
The region where the selected availability zone resides. This is always the region selected on the provider, since this data source searches only within that region.
- State string
- Zone
Id string - All
Availability boolZones - Filters
[]Get
Availability Zone Filter
- group
Name string For Availability Zones, this is the same value as the Region name. For Local Zones, the name of the associated group, for example
us-west-2-lax-1.- id string
The provider-assigned unique ID for this managed resource.
- name string
- name
Suffix string The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.
- network
Border stringGroup The name of the location from which the address is advertised.
- opt
In stringStatus For Availability Zones, this always has the value of
opt-in-not-required. For Local Zones, this is the opt in status. The possible values areopted-inandnot-opted-in.- region string
The region where the selected availability zone resides. This is always the region selected on the provider, since this data source searches only within that region.
- state string
- zone
Id string - all
Availability booleanZones - filters
Get
Availability Zone Filter[]
- group_
name str For Availability Zones, this is the same value as the Region name. For Local Zones, the name of the associated group, for example
us-west-2-lax-1.- id str
The provider-assigned unique ID for this managed resource.
- name str
- name_
suffix str The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.
- network_
border_ strgroup The name of the location from which the address is advertised.
- opt_
in_ strstatus For Availability Zones, this always has the value of
opt-in-not-required. For Local Zones, this is the opt in status. The possible values areopted-inandnot-opted-in.- region str
The region where the selected availability zone resides. This is always the region selected on the provider, since this data source searches only within that region.
- state str
- zone_
id str - all_
availability_ boolzones - filters
List[Get
Availability Zone Filter]
Supporting Types
GetAvailabilityZoneFilter
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- Values List<string>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- Values []string
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name string
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- values string[]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name str
The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
- values List[str]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.