UNPKG

@pulumi/aws

Version:

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

143 lines 7.71 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Subnet = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an VPC subnet resource. * * > **NOTE:** Due to [AWS Lambda improved VPC networking changes that began deploying in September 2019](https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/), subnets associated with Lambda Functions can take up to 45 minutes to successfully delete. To allow for successful deletion, the provider will wait for at least 45 minutes even if a shorter delete timeout is specified. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.ec2.Subnet("main", { * vpcId: mainAwsVpc.id, * cidrBlock: "10.0.1.0/24", * tags: { * Name: "Main", * }, * }); * ``` * * ### Subnets In Secondary VPC CIDR Blocks * * When managing subnets in one of a VPC's secondary CIDR blocks created using a `aws.ec2.VpcIpv4CidrBlockAssociation` * resource, it is recommended to reference that resource's `vpcId` attribute to ensure correct dependency ordering. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const secondaryCidr = new aws.ec2.VpcIpv4CidrBlockAssociation("secondary_cidr", { * vpcId: main.id, * cidrBlock: "172.20.0.0/16", * }); * const inSecondaryCidr = new aws.ec2.Subnet("in_secondary_cidr", { * vpcId: secondaryCidr.vpcId, * cidrBlock: "172.20.0.0/24", * }); * ``` * * ## Import * * Using `pulumi import`, import subnets using the subnet `id`. For example: * * ```sh * $ pulumi import aws:ec2/subnet:Subnet public_subnet subnet-9d4a7b6c * ``` */ class Subnet extends pulumi.CustomResource { /** * Get an existing Subnet resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Subnet(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Subnet. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Subnet.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["assignIpv6AddressOnCreation"] = state ? state.assignIpv6AddressOnCreation : undefined; resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined; resourceInputs["availabilityZoneId"] = state ? state.availabilityZoneId : undefined; resourceInputs["cidrBlock"] = state ? state.cidrBlock : undefined; resourceInputs["customerOwnedIpv4Pool"] = state ? state.customerOwnedIpv4Pool : undefined; resourceInputs["enableDns64"] = state ? state.enableDns64 : undefined; resourceInputs["enableLniAtDeviceIndex"] = state ? state.enableLniAtDeviceIndex : undefined; resourceInputs["enableResourceNameDnsARecordOnLaunch"] = state ? state.enableResourceNameDnsARecordOnLaunch : undefined; resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = state ? state.enableResourceNameDnsAaaaRecordOnLaunch : undefined; resourceInputs["ipv6CidrBlock"] = state ? state.ipv6CidrBlock : undefined; resourceInputs["ipv6CidrBlockAssociationId"] = state ? state.ipv6CidrBlockAssociationId : undefined; resourceInputs["ipv6Native"] = state ? state.ipv6Native : undefined; resourceInputs["mapCustomerOwnedIpOnLaunch"] = state ? state.mapCustomerOwnedIpOnLaunch : undefined; resourceInputs["mapPublicIpOnLaunch"] = state ? state.mapPublicIpOnLaunch : undefined; resourceInputs["outpostArn"] = state ? state.outpostArn : undefined; resourceInputs["ownerId"] = state ? state.ownerId : undefined; resourceInputs["privateDnsHostnameTypeOnLaunch"] = state ? state.privateDnsHostnameTypeOnLaunch : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; if ((!args || args.vpcId === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["assignIpv6AddressOnCreation"] = args ? args.assignIpv6AddressOnCreation : undefined; resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined; resourceInputs["availabilityZoneId"] = args ? args.availabilityZoneId : undefined; resourceInputs["cidrBlock"] = args ? args.cidrBlock : undefined; resourceInputs["customerOwnedIpv4Pool"] = args ? args.customerOwnedIpv4Pool : undefined; resourceInputs["enableDns64"] = args ? args.enableDns64 : undefined; resourceInputs["enableLniAtDeviceIndex"] = args ? args.enableLniAtDeviceIndex : undefined; resourceInputs["enableResourceNameDnsARecordOnLaunch"] = args ? args.enableResourceNameDnsARecordOnLaunch : undefined; resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = args ? args.enableResourceNameDnsAaaaRecordOnLaunch : undefined; resourceInputs["ipv6CidrBlock"] = args ? args.ipv6CidrBlock : undefined; resourceInputs["ipv6Native"] = args ? args.ipv6Native : undefined; resourceInputs["mapCustomerOwnedIpOnLaunch"] = args ? args.mapCustomerOwnedIpOnLaunch : undefined; resourceInputs["mapPublicIpOnLaunch"] = args ? args.mapPublicIpOnLaunch : undefined; resourceInputs["outpostArn"] = args ? args.outpostArn : undefined; resourceInputs["privateDnsHostnameTypeOnLaunch"] = args ? args.privateDnsHostnameTypeOnLaunch : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["ipv6CidrBlockAssociationId"] = undefined /*out*/; resourceInputs["ownerId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Subnet.__pulumiType, name, resourceInputs, opts); } } exports.Subnet = Subnet; /** @internal */ Subnet.__pulumiType = 'aws:ec2/subnet:Subnet'; //# sourceMappingURL=subnet.js.map