@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
157 lines • 6.67 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.Vpc = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a VPC resource.
*
* ## Example Usage
*
* Basic usage:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const main = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"});
* ```
*
* Basic usage with tags:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const main = new aws.ec2.Vpc("main", {
* cidrBlock: "10.0.0.0/16",
* instanceTenancy: "default",
* tags: {
* Name: "main",
* },
* });
* ```
*
* VPC with CIDR from AWS IPAM:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getRegion({});
* const test = new aws.ec2.VpcIpam("test", {operatingRegions: [{
* regionName: current.then(current => current.region),
* }]});
* const testVpcIpamPool = new aws.ec2.VpcIpamPool("test", {
* addressFamily: "ipv4",
* ipamScopeId: test.privateDefaultScopeId,
* locale: current.then(current => current.region),
* });
* const testVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("test", {
* ipamPoolId: testVpcIpamPool.id,
* cidr: "172.20.0.0/16",
* });
* const testVpc = new aws.ec2.Vpc("test", {
* ipv4IpamPoolId: testVpcIpamPool.id,
* ipv4NetmaskLength: 28,
* }, {
* dependsOn: [testVpcIpamPoolCidr],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import VPCs using the VPC `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/vpc:Vpc test_vpc vpc-a01106c2
* ```
*/
class Vpc extends pulumi.CustomResource {
/**
* Get an existing Vpc 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 Vpc(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Vpc. 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'] === Vpc.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["assignGeneratedIpv6CidrBlock"] = state?.assignGeneratedIpv6CidrBlock;
resourceInputs["cidrBlock"] = state?.cidrBlock;
resourceInputs["defaultNetworkAclId"] = state?.defaultNetworkAclId;
resourceInputs["defaultRouteTableId"] = state?.defaultRouteTableId;
resourceInputs["defaultSecurityGroupId"] = state?.defaultSecurityGroupId;
resourceInputs["dhcpOptionsId"] = state?.dhcpOptionsId;
resourceInputs["enableDnsHostnames"] = state?.enableDnsHostnames;
resourceInputs["enableDnsSupport"] = state?.enableDnsSupport;
resourceInputs["enableNetworkAddressUsageMetrics"] = state?.enableNetworkAddressUsageMetrics;
resourceInputs["instanceTenancy"] = state?.instanceTenancy;
resourceInputs["ipv4IpamPoolId"] = state?.ipv4IpamPoolId;
resourceInputs["ipv4NetmaskLength"] = state?.ipv4NetmaskLength;
resourceInputs["ipv6AssociationId"] = state?.ipv6AssociationId;
resourceInputs["ipv6CidrBlock"] = state?.ipv6CidrBlock;
resourceInputs["ipv6CidrBlockNetworkBorderGroup"] = state?.ipv6CidrBlockNetworkBorderGroup;
resourceInputs["ipv6IpamPoolId"] = state?.ipv6IpamPoolId;
resourceInputs["ipv6NetmaskLength"] = state?.ipv6NetmaskLength;
resourceInputs["mainRouteTableId"] = state?.mainRouteTableId;
resourceInputs["ownerId"] = state?.ownerId;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
resourceInputs["assignGeneratedIpv6CidrBlock"] = args?.assignGeneratedIpv6CidrBlock;
resourceInputs["cidrBlock"] = args?.cidrBlock;
resourceInputs["enableDnsHostnames"] = args?.enableDnsHostnames;
resourceInputs["enableDnsSupport"] = args?.enableDnsSupport;
resourceInputs["enableNetworkAddressUsageMetrics"] = args?.enableNetworkAddressUsageMetrics;
resourceInputs["instanceTenancy"] = args?.instanceTenancy;
resourceInputs["ipv4IpamPoolId"] = args?.ipv4IpamPoolId;
resourceInputs["ipv4NetmaskLength"] = args?.ipv4NetmaskLength;
resourceInputs["ipv6CidrBlock"] = args?.ipv6CidrBlock;
resourceInputs["ipv6CidrBlockNetworkBorderGroup"] = args?.ipv6CidrBlockNetworkBorderGroup;
resourceInputs["ipv6IpamPoolId"] = args?.ipv6IpamPoolId;
resourceInputs["ipv6NetmaskLength"] = args?.ipv6NetmaskLength;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["defaultNetworkAclId"] = undefined /*out*/;
resourceInputs["defaultRouteTableId"] = undefined /*out*/;
resourceInputs["defaultSecurityGroupId"] = undefined /*out*/;
resourceInputs["dhcpOptionsId"] = undefined /*out*/;
resourceInputs["ipv6AssociationId"] = undefined /*out*/;
resourceInputs["mainRouteTableId"] = undefined /*out*/;
resourceInputs["ownerId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Vpc.__pulumiType, name, resourceInputs, opts);
}
}
exports.Vpc = Vpc;
/** @internal */
Vpc.__pulumiType = 'aws:ec2/vpc:Vpc';
//# sourceMappingURL=vpc.js.map