UNPKG

@pulumi/aws

Version:

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

276 lines (275 loc) • 8.91 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * `aws.ec2.Subnet` provides details about a specific VPC subnet. * * This resource can prove useful when a module accepts a subnet ID as an input variable and needs to, for example, determine the ID of the VPC that the subnet belongs to. * * ## Example Usage * * The following example shows how one might accept a subnet ID as a variable and use this data source to obtain the data necessary to create a security group that allows connections from hosts in that subnet. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const config = new pulumi.Config(); * const subnetId = config.requireObject<any>("subnetId"); * const selected = aws.ec2.getSubnet({ * id: subnetId, * }); * const subnetSecurityGroup = new aws.ec2.SecurityGroup("subnet_security_group", { * vpcId: selected.then(selected => selected.vpcId), * ingress: [{ * cidrBlocks: [selected.then(selected => selected.cidrBlock)], * fromPort: 80, * toPort: 80, * protocol: "tcp", * }], * }); * ``` * * ### Filter Example * * If you want to match against tag `Name`, use: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const selected = aws.ec2.getSubnet({ * filters: [{ * name: "tag:Name", * values: ["yakdriver"], * }], * }); * ``` */ export declare function getSubnet(args?: GetSubnetArgs, opts?: pulumi.InvokeOptions): Promise<GetSubnetResult>; /** * A collection of arguments for invoking getSubnet. */ export interface GetSubnetArgs { /** * Availability zone where the subnet must reside. */ availabilityZone?: string; /** * ID of the Availability Zone for the subnet. This argument is not supported in all regions or partitions. If necessary, use `availabilityZone` instead. */ availabilityZoneId?: string; /** * CIDR block of the desired subnet. */ cidrBlock?: string; /** * Whether the desired subnet must be the default subnet for its associated availability zone. */ defaultForAz?: boolean; /** * Configuration block. Detailed below. */ filters?: inputs.ec2.GetSubnetFilter[]; /** * ID of the specific subnet to retrieve. */ id?: string; /** * IPv6 CIDR block of the desired subnet. */ ipv6CidrBlock?: 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; /** * State that the desired subnet must have. */ state?: string; /** * Map of tags, each pair of which must exactly match a pair on the desired subnet. */ tags?: { [key: string]: string; }; /** * ID of the VPC that the desired subnet belongs to. */ vpcId?: string; } /** * A collection of values returned by getSubnet. */ export interface GetSubnetResult { /** * ARN of the subnet. */ readonly arn: string; /** * Whether an IPv6 address is assigned on creation. */ readonly assignIpv6AddressOnCreation: boolean; readonly availabilityZone: string; readonly availabilityZoneId: string; /** * Available IP addresses of the subnet. */ readonly availableIpAddressCount: number; readonly cidrBlock: string; /** * Identifier of customer owned IPv4 address pool. */ readonly customerOwnedIpv4Pool: string; readonly defaultForAz: boolean; /** * Whether DNS queries made to the Amazon-provided DNS Resolver in this subnet return synthetic IPv6 addresses for IPv4-only destinations. */ readonly enableDns64: boolean; /** * Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1). A local network interface cannot be the primary network interface (eth0). */ readonly enableLniAtDeviceIndex: number; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS A records. */ readonly enableResourceNameDnsARecordOnLaunch: boolean; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. */ readonly enableResourceNameDnsAaaaRecordOnLaunch: boolean; readonly filters?: outputs.ec2.GetSubnetFilter[]; readonly id: string; readonly ipv6CidrBlock: string; /** * Association ID of the IPv6 CIDR block. */ readonly ipv6CidrBlockAssociationId: string; /** * Whether this is an IPv6-only subnet. */ readonly ipv6Native: boolean; /** * Whether customer owned IP addresses are assigned on network interface creation. */ readonly mapCustomerOwnedIpOnLaunch: boolean; /** * Whether public IP addresses are assigned on instance launch. */ readonly mapPublicIpOnLaunch: boolean; /** * ARN of the Outpost. */ readonly outpostArn: string; /** * ID of the AWS account that owns the subnet. */ readonly ownerId: string; /** * The type of hostnames assigned to instances in the subnet at launch. */ readonly privateDnsHostnameTypeOnLaunch: string; readonly region: string; readonly state: string; readonly tags: { [key: string]: string; }; readonly vpcId: string; } /** * `aws.ec2.Subnet` provides details about a specific VPC subnet. * * This resource can prove useful when a module accepts a subnet ID as an input variable and needs to, for example, determine the ID of the VPC that the subnet belongs to. * * ## Example Usage * * The following example shows how one might accept a subnet ID as a variable and use this data source to obtain the data necessary to create a security group that allows connections from hosts in that subnet. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const config = new pulumi.Config(); * const subnetId = config.requireObject<any>("subnetId"); * const selected = aws.ec2.getSubnet({ * id: subnetId, * }); * const subnetSecurityGroup = new aws.ec2.SecurityGroup("subnet_security_group", { * vpcId: selected.then(selected => selected.vpcId), * ingress: [{ * cidrBlocks: [selected.then(selected => selected.cidrBlock)], * fromPort: 80, * toPort: 80, * protocol: "tcp", * }], * }); * ``` * * ### Filter Example * * If you want to match against tag `Name`, use: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const selected = aws.ec2.getSubnet({ * filters: [{ * name: "tag:Name", * values: ["yakdriver"], * }], * }); * ``` */ export declare function getSubnetOutput(args?: GetSubnetOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetSubnetResult>; /** * A collection of arguments for invoking getSubnet. */ export interface GetSubnetOutputArgs { /** * Availability zone where the subnet must reside. */ availabilityZone?: pulumi.Input<string>; /** * ID of the Availability Zone for the subnet. This argument is not supported in all regions or partitions. If necessary, use `availabilityZone` instead. */ availabilityZoneId?: pulumi.Input<string>; /** * CIDR block of the desired subnet. */ cidrBlock?: pulumi.Input<string>; /** * Whether the desired subnet must be the default subnet for its associated availability zone. */ defaultForAz?: pulumi.Input<boolean>; /** * Configuration block. Detailed below. */ filters?: pulumi.Input<pulumi.Input<inputs.ec2.GetSubnetFilterArgs>[]>; /** * ID of the specific subnet to retrieve. */ id?: pulumi.Input<string>; /** * IPv6 CIDR block of the desired subnet. */ ipv6CidrBlock?: 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>; /** * State that the desired subnet must have. */ state?: pulumi.Input<string>; /** * Map of tags, each pair of which must exactly match a pair on the desired subnet. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * ID of the VPC that the desired subnet belongs to. */ vpcId?: pulumi.Input<string>; }