UNPKG

@pulumi/aws

Version:

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

130 lines 7.01 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.DefaultSubnet = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage a [default subnet](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html#default-vpc-basics) in the current region. * * **This is an advanced resource** and has special caveats to be aware of when using it. Please read this document in its entirety before using this resource. * * The `aws.ec2.DefaultSubnet` resource behaves differently from normal resources in that if a default subnet exists in the specified Availability Zone, this provider does not _create_ this resource, but instead "adopts" it into management. * If no default subnet exists, this provider creates a new default subnet. * By default, `pulumi destroy` does not delete the default subnet but does remove the resource from the state. * Set the `forceDestroy` argument to `true` to delete the default subnet. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const defaultAz1 = new aws.ec2.DefaultSubnet("default_az1", { * availabilityZone: "us-west-2a", * tags: { * Name: "Default subnet for us-west-2a", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import subnets using the subnet `id`. For example: * * ```sh * $ pulumi import aws:ec2/defaultSubnet:DefaultSubnet public_subnet subnet-9d4a7b6c * ``` */ class DefaultSubnet extends pulumi.CustomResource { /** * Get an existing DefaultSubnet 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 DefaultSubnet(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DefaultSubnet. 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'] === DefaultSubnet.__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["existingDefaultSubnet"] = state?.existingDefaultSubnet; resourceInputs["forceDestroy"] = state?.forceDestroy; 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?.availabilityZone === undefined && !opts.urn) { throw new Error("Missing required property 'availabilityZone'"); } resourceInputs["assignIpv6AddressOnCreation"] = args?.assignIpv6AddressOnCreation; resourceInputs["availabilityZone"] = args?.availabilityZone; resourceInputs["customerOwnedIpv4Pool"] = args?.customerOwnedIpv4Pool; resourceInputs["enableDns64"] = args?.enableDns64; resourceInputs["enableResourceNameDnsARecordOnLaunch"] = args?.enableResourceNameDnsARecordOnLaunch; resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = args?.enableResourceNameDnsAaaaRecordOnLaunch; resourceInputs["forceDestroy"] = args?.forceDestroy; resourceInputs["ipv6CidrBlock"] = args?.ipv6CidrBlock; resourceInputs["ipv6Native"] = args?.ipv6Native; resourceInputs["mapCustomerOwnedIpOnLaunch"] = args?.mapCustomerOwnedIpOnLaunch; resourceInputs["mapPublicIpOnLaunch"] = args?.mapPublicIpOnLaunch; resourceInputs["privateDnsHostnameTypeOnLaunch"] = args?.privateDnsHostnameTypeOnLaunch; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["availabilityZoneId"] = undefined /*out*/; resourceInputs["cidrBlock"] = undefined /*out*/; resourceInputs["enableLniAtDeviceIndex"] = undefined /*out*/; resourceInputs["existingDefaultSubnet"] = undefined /*out*/; resourceInputs["ipv6CidrBlockAssociationId"] = undefined /*out*/; resourceInputs["outpostArn"] = undefined /*out*/; resourceInputs["ownerId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["vpcId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DefaultSubnet.__pulumiType, name, resourceInputs, opts); } } exports.DefaultSubnet = DefaultSubnet; /** @internal */ DefaultSubnet.__pulumiType = 'aws:ec2/defaultSubnet:DefaultSubnet'; //# sourceMappingURL=defaultSubnet.js.map