UNPKG

@pulumi/aws

Version:

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

155 lines 7.15 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 * * ### Identity Schema * * #### Required * * * `id` (String) ID of the subnet. * * #### Optional * * * `account_id` (String) AWS Account where this resource is managed. * * * `region` (String) Region where this resource is managed. * * Using `pulumi import`, import subnets using the subnet `id`. For example: * * console * * % pulumi import aws_subnet.example 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, { ...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?.arn; resourceInputs["assignIpv6AddressOnCreation"] = state?.assignIpv6AddressOnCreation; resourceInputs["availabilityZone"] = state?.availabilityZone; resourceInputs["availabilityZoneId"] = state?.availabilityZoneId; resourceInputs["cidrBlock"] = state?.cidrBlock; resourceInputs["customerOwnedIpv4Pool"] = state?.customerOwnedIpv4Pool; resourceInputs["enableDns64"] = state?.enableDns64; resourceInputs["enableLniAtDeviceIndex"] = state?.enableLniAtDeviceIndex; resourceInputs["enableResourceNameDnsARecordOnLaunch"] = state?.enableResourceNameDnsARecordOnLaunch; resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = state?.enableResourceNameDnsAaaaRecordOnLaunch; resourceInputs["ipv6CidrBlock"] = state?.ipv6CidrBlock; resourceInputs["ipv6CidrBlockAssociationId"] = state?.ipv6CidrBlockAssociationId; resourceInputs["ipv6Native"] = state?.ipv6Native; resourceInputs["mapCustomerOwnedIpOnLaunch"] = state?.mapCustomerOwnedIpOnLaunch; resourceInputs["mapPublicIpOnLaunch"] = state?.mapPublicIpOnLaunch; resourceInputs["outpostArn"] = state?.outpostArn; resourceInputs["ownerId"] = state?.ownerId; resourceInputs["privateDnsHostnameTypeOnLaunch"] = state?.privateDnsHostnameTypeOnLaunch; resourceInputs["region"] = state?.region; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["vpcId"] = state?.vpcId; } else { const args = argsOrState; if (args?.vpcId === undefined && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["assignIpv6AddressOnCreation"] = args?.assignIpv6AddressOnCreation; resourceInputs["availabilityZone"] = args?.availabilityZone; resourceInputs["availabilityZoneId"] = args?.availabilityZoneId; resourceInputs["cidrBlock"] = args?.cidrBlock; resourceInputs["customerOwnedIpv4Pool"] = args?.customerOwnedIpv4Pool; resourceInputs["enableDns64"] = args?.enableDns64; resourceInputs["enableLniAtDeviceIndex"] = args?.enableLniAtDeviceIndex; resourceInputs["enableResourceNameDnsARecordOnLaunch"] = args?.enableResourceNameDnsARecordOnLaunch; resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = args?.enableResourceNameDnsAaaaRecordOnLaunch; resourceInputs["ipv6CidrBlock"] = args?.ipv6CidrBlock; resourceInputs["ipv6Native"] = args?.ipv6Native; resourceInputs["mapCustomerOwnedIpOnLaunch"] = args?.mapCustomerOwnedIpOnLaunch; resourceInputs["mapPublicIpOnLaunch"] = args?.mapPublicIpOnLaunch; resourceInputs["outpostArn"] = args?.outpostArn; resourceInputs["privateDnsHostnameTypeOnLaunch"] = args?.privateDnsHostnameTypeOnLaunch; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["vpcId"] = args?.vpcId; 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