UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

243 lines (242 loc) 9.36 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * `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 * * The following example shows how this data source might be used to derive * VPC and subnet CIDR prefixes systematically for an availability zone. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const config = new pulumi.Config(); * const regionNumber = config.getObject<any>("regionNumber") || { * "ap-northeast-1": 5, * "eu-central-1": 4, * "us-east-1": 1, * "us-west-1": 2, * "us-west-2": 3, * }; * const azNumber = config.getObject<any>("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 example = aws.getAvailabilityZone({ * name: "eu-central-1a", * }); * // Create a VPC for the region associated with the AZ * const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: example.then(example => std.cidrsubnet({ * input: "10.0.0.0/8", * newbits: 4, * netnum: regionNumber[example.region], * })).then(invoke => invoke.result)}); * // Create a subnet for the AZ within the regional VPC * const exampleSubnet = new aws.ec2.Subnet("example", { * vpcId: exampleVpc.id, * cidrBlock: pulumi.all([exampleVpc.cidrBlock, example]).apply(([cidrBlock, example]) => std.cidrsubnetOutput({ * input: cidrBlock, * newbits: 4, * netnum: azNumber[example.nameSuffix], * })).apply(invoke => invoke.result), * }); * ``` */ export declare function getAvailabilityZone(args?: GetAvailabilityZoneArgs, opts?: pulumi.InvokeOptions): Promise<GetAvailabilityZoneResult>; /** * A collection of arguments for invoking getAvailabilityZone. */ export interface GetAvailabilityZoneArgs { /** * Set to `true` to include all Availability Zones and Local Zones regardless of your opt in status. */ allAvailabilityZones?: boolean; /** * Configuration block(s) for filtering. Detailed below. */ filters?: inputs.GetAvailabilityZoneFilter[]; /** * Full name of the availability zone to select. */ name?: string; /** * 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; /** * Specific availability zone state to require. May be any of `"available"`, `"information"` or `"impaired"`. */ state?: string; /** * Zone ID of the availability zone to select. * * The arguments of this data source act as filters for querying the available * availability zones. The given filters must match exactly one availability * zone whose data will be exported as attributes. */ zoneId?: string; } /** * A collection of values returned by getAvailabilityZone. */ export interface GetAvailabilityZoneResult { readonly allAvailabilityZones?: boolean; readonly filters?: outputs.GetAvailabilityZoneFilter[]; /** * The long name of the Availability Zone group, Local Zone group, or Wavelength Zone group. */ readonly groupLongName: string; /** * The name of the zone group. For example: `us-east-1-zg-1`, `us-west-2-lax-1`, or `us-east-1-wl1-bos-wlz-1`. */ readonly groupName: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; readonly name: string; /** * Part of the AZ name that appears after the region name, uniquely identifying the AZ within its region. * For Availability Zones this is usually a single letter, for example `a` for the `us-west-2a` zone. * For Local and Wavelength Zones this is a longer string, for example `wl1-sfo-wlz-1` for the `us-west-2-wl1-sfo-wlz-1` zone. */ readonly nameSuffix: string; /** * The name of the location from which the address is advertised. */ readonly networkBorderGroup: string; /** * 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 are `opted-in` and `not-opted-in`. */ readonly optInStatus: string; /** * ID of the zone that handles some of the Local Zone or Wavelength Zone control plane operations, such as API calls. */ readonly parentZoneId: string; /** * Name of the zone that handles some of the Local Zone or Wavelength Zone control plane operations, such as API calls. */ readonly parentZoneName: string; readonly region: string; readonly state: string; readonly zoneId: string; /** * Type of zone. Values are `availability-zone`, `local-zone`, and `wavelength-zone`. */ readonly zoneType: string; } /** * `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 * * The following example shows how this data source might be used to derive * VPC and subnet CIDR prefixes systematically for an availability zone. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const config = new pulumi.Config(); * const regionNumber = config.getObject<any>("regionNumber") || { * "ap-northeast-1": 5, * "eu-central-1": 4, * "us-east-1": 1, * "us-west-1": 2, * "us-west-2": 3, * }; * const azNumber = config.getObject<any>("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 example = aws.getAvailabilityZone({ * name: "eu-central-1a", * }); * // Create a VPC for the region associated with the AZ * const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: example.then(example => std.cidrsubnet({ * input: "10.0.0.0/8", * newbits: 4, * netnum: regionNumber[example.region], * })).then(invoke => invoke.result)}); * // Create a subnet for the AZ within the regional VPC * const exampleSubnet = new aws.ec2.Subnet("example", { * vpcId: exampleVpc.id, * cidrBlock: pulumi.all([exampleVpc.cidrBlock, example]).apply(([cidrBlock, example]) => std.cidrsubnetOutput({ * input: cidrBlock, * newbits: 4, * netnum: azNumber[example.nameSuffix], * })).apply(invoke => invoke.result), * }); * ``` */ export declare function getAvailabilityZoneOutput(args?: GetAvailabilityZoneOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetAvailabilityZoneResult>; /** * A collection of arguments for invoking getAvailabilityZone. */ export interface GetAvailabilityZoneOutputArgs { /** * Set to `true` to include all Availability Zones and Local Zones regardless of your opt in status. */ allAvailabilityZones?: pulumi.Input<boolean>; /** * Configuration block(s) for filtering. Detailed below. */ filters?: pulumi.Input<pulumi.Input<inputs.GetAvailabilityZoneFilterArgs>[]>; /** * Full name of the availability zone to select. */ name?: pulumi.Input<string>; /** * 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>; /** * Specific availability zone state to require. May be any of `"available"`, `"information"` or `"impaired"`. */ state?: pulumi.Input<string>; /** * Zone ID of the availability zone to select. * * The arguments of this data source act as filters for querying the available * availability zones. The given filters must match exactly one availability * zone whose data will be exported as attributes. */ zoneId?: pulumi.Input<string>; }