@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
130 lines • 7.76 kB
JavaScript
;
// *** 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, Object.assign(Object.assign({}, 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 ? 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["existingDefaultSubnet"] = state ? state.existingDefaultSubnet : undefined;
resourceInputs["forceDestroy"] = state ? state.forceDestroy : 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.availabilityZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
resourceInputs["assignIpv6AddressOnCreation"] = args ? args.assignIpv6AddressOnCreation : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["customerOwnedIpv4Pool"] = args ? args.customerOwnedIpv4Pool : undefined;
resourceInputs["enableDns64"] = args ? args.enableDns64 : undefined;
resourceInputs["enableResourceNameDnsARecordOnLaunch"] = args ? args.enableResourceNameDnsARecordOnLaunch : undefined;
resourceInputs["enableResourceNameDnsAaaaRecordOnLaunch"] = args ? args.enableResourceNameDnsAaaaRecordOnLaunch : undefined;
resourceInputs["forceDestroy"] = args ? args.forceDestroy : 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["privateDnsHostnameTypeOnLaunch"] = args ? args.privateDnsHostnameTypeOnLaunch : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
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