@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
219 lines (218 loc) • 7.79 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* 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.
*
* This is different from the `aws.getAvailabilityZone` (singular) data source,
* which provides some details about a specific availability zone.
*
* > When [Local Zones](https://aws.amazon.com/about-aws/global-infrastructure/localzones/) are enabled in a region, by default the API and this data source include both Local Zones and Availability Zones. To return only Availability Zones, see the example section below.
*
* ## Example Usage
*
* ### By State
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // Declare the data source
* const available = aws.getAvailabilityZones({
* state: "available",
* });
* // e.g., Create subnets in the first two available availability zones
* const primary = new aws.ec2.Subnet("primary", {availabilityZone: available.then(available => available.names?.[0])});
* const secondary = new aws.ec2.Subnet("secondary", {availabilityZone: available.then(available => available.names?.[1])});
* ```
*
* ### By Filter
*
* All Local Zones (regardless of opt-in status):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.getAvailabilityZones({
* allAvailabilityZones: true,
* filters: [{
* name: "opt-in-status",
* values: [
* "not-opted-in",
* "opted-in",
* ],
* }],
* });
* ```
*
* Only Availability Zones (no Local Zones):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.getAvailabilityZones({
* filters: [{
* name: "opt-in-status",
* values: ["opt-in-not-required"],
* }],
* });
* ```
*/
export declare function getAvailabilityZones(args?: GetAvailabilityZonesArgs, opts?: pulumi.InvokeOptions): Promise<GetAvailabilityZonesResult>;
/**
* A collection of arguments for invoking getAvailabilityZones.
*/
export interface GetAvailabilityZonesArgs {
/**
* Set to `true` to include all Availability Zones and Local Zones regardless of your opt in status.
*/
allAvailabilityZones?: boolean;
/**
* List of Availability Zone names to exclude.
*/
excludeNames?: string[];
/**
* List of Availability Zone IDs to exclude.
*/
excludeZoneIds?: string[];
/**
* Configuration block(s) for filtering. Detailed below.
*/
filters?: inputs.GetAvailabilityZonesFilter[];
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: string;
/**
* 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.
*/
state?: string;
}
/**
* A collection of values returned by getAvailabilityZones.
*/
export interface GetAvailabilityZonesResult {
readonly allAvailabilityZones?: boolean;
readonly excludeNames?: string[];
readonly excludeZoneIds?: string[];
readonly filters?: outputs.GetAvailabilityZonesFilter[];
/**
* A set of the Availability Zone Group names. 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`.
*/
readonly groupNames: string[];
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
/**
* List of the Availability Zone names available to the account.
*/
readonly names: string[];
readonly region: string;
readonly state?: string;
/**
* List of the Availability Zone IDs available to the account.
*/
readonly zoneIds: string[];
}
/**
* 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.
*
* This is different from the `aws.getAvailabilityZone` (singular) data source,
* which provides some details about a specific availability zone.
*
* > When [Local Zones](https://aws.amazon.com/about-aws/global-infrastructure/localzones/) are enabled in a region, by default the API and this data source include both Local Zones and Availability Zones. To return only Availability Zones, see the example section below.
*
* ## Example Usage
*
* ### By State
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // Declare the data source
* const available = aws.getAvailabilityZones({
* state: "available",
* });
* // e.g., Create subnets in the first two available availability zones
* const primary = new aws.ec2.Subnet("primary", {availabilityZone: available.then(available => available.names?.[0])});
* const secondary = new aws.ec2.Subnet("secondary", {availabilityZone: available.then(available => available.names?.[1])});
* ```
*
* ### By Filter
*
* All Local Zones (regardless of opt-in status):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.getAvailabilityZones({
* allAvailabilityZones: true,
* filters: [{
* name: "opt-in-status",
* values: [
* "not-opted-in",
* "opted-in",
* ],
* }],
* });
* ```
*
* Only Availability Zones (no Local Zones):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.getAvailabilityZones({
* filters: [{
* name: "opt-in-status",
* values: ["opt-in-not-required"],
* }],
* });
* ```
*/
export declare function getAvailabilityZonesOutput(args?: GetAvailabilityZonesOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetAvailabilityZonesResult>;
/**
* A collection of arguments for invoking getAvailabilityZones.
*/
export interface GetAvailabilityZonesOutputArgs {
/**
* Set to `true` to include all Availability Zones and Local Zones regardless of your opt in status.
*/
allAvailabilityZones?: pulumi.Input<boolean>;
/**
* List of Availability Zone names to exclude.
*/
excludeNames?: pulumi.Input<pulumi.Input<string>[]>;
/**
* List of Availability Zone IDs to exclude.
*/
excludeZoneIds?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Configuration block(s) for filtering. Detailed below.
*/
filters?: pulumi.Input<pulumi.Input<inputs.GetAvailabilityZonesFilterArgs>[]>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* 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.
*/
state?: pulumi.Input<string>;
}