@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
147 lines • 6.22 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.NatGateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to create a VPC NAT Gateway.
*
* !> **WARNING:** You should not use the `aws.ec2.NatGateway` resource that has `secondaryAllocationIds` in conjunction with an `aws.ec2.NatGatewayEipAssociation` resource. Doing so may cause perpetual differences, and result in associations being overwritten.
*
* ## Example Usage
*
* ### Public NAT
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.NatGateway("example", {
* allocationId: exampleAwsEip.id,
* subnetId: exampleAwsSubnet.id,
* tags: {
* Name: "gw NAT",
* },
* }, {
* dependsOn: [exampleAwsInternetGateway],
* });
* ```
*
* ### Public NAT with Secondary Private IP Addresses
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.NatGateway("example", {
* allocationId: exampleAwsEip.id,
* subnetId: exampleAwsSubnet.id,
* secondaryAllocationIds: [secondary.id],
* secondaryPrivateIpAddresses: ["10.0.1.5"],
* });
* ```
*
* ### Private NAT
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.NatGateway("example", {
* connectivityType: "private",
* subnetId: exampleAwsSubnet.id,
* });
* ```
*
* ### Private NAT with Secondary Private IP Addresses
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.NatGateway("example", {
* connectivityType: "private",
* subnetId: exampleAwsSubnet.id,
* secondaryPrivateIpAddressCount: 7,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import NAT Gateways using the `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/natGateway:NatGateway private_gw nat-05dba92075d71c408
* ```
*/
class NatGateway extends pulumi.CustomResource {
/**
* Get an existing NatGateway 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 NatGateway(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NatGateway. 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'] === NatGateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allocationId"] = state ? state.allocationId : undefined;
resourceInputs["associationId"] = state ? state.associationId : undefined;
resourceInputs["connectivityType"] = state ? state.connectivityType : undefined;
resourceInputs["networkInterfaceId"] = state ? state.networkInterfaceId : undefined;
resourceInputs["privateIp"] = state ? state.privateIp : undefined;
resourceInputs["publicIp"] = state ? state.publicIp : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["secondaryAllocationIds"] = state ? state.secondaryAllocationIds : undefined;
resourceInputs["secondaryPrivateIpAddressCount"] = state ? state.secondaryPrivateIpAddressCount : undefined;
resourceInputs["secondaryPrivateIpAddresses"] = state ? state.secondaryPrivateIpAddresses : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
}
else {
const args = argsOrState;
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
resourceInputs["allocationId"] = args ? args.allocationId : undefined;
resourceInputs["connectivityType"] = args ? args.connectivityType : undefined;
resourceInputs["privateIp"] = args ? args.privateIp : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["secondaryAllocationIds"] = args ? args.secondaryAllocationIds : undefined;
resourceInputs["secondaryPrivateIpAddressCount"] = args ? args.secondaryPrivateIpAddressCount : undefined;
resourceInputs["secondaryPrivateIpAddresses"] = args ? args.secondaryPrivateIpAddresses : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["associationId"] = undefined /*out*/;
resourceInputs["networkInterfaceId"] = undefined /*out*/;
resourceInputs["publicIp"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NatGateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.NatGateway = NatGateway;
/** @internal */
NatGateway.__pulumiType = 'aws:ec2/natGateway:NatGateway';
//# sourceMappingURL=natGateway.js.map