UNPKG

@pulumi/aws

Version:

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

147 lines 5.77 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.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, { ...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?.allocationId; resourceInputs["associationId"] = state?.associationId; resourceInputs["connectivityType"] = state?.connectivityType; resourceInputs["networkInterfaceId"] = state?.networkInterfaceId; resourceInputs["privateIp"] = state?.privateIp; resourceInputs["publicIp"] = state?.publicIp; resourceInputs["region"] = state?.region; resourceInputs["secondaryAllocationIds"] = state?.secondaryAllocationIds; resourceInputs["secondaryPrivateIpAddressCount"] = state?.secondaryPrivateIpAddressCount; resourceInputs["secondaryPrivateIpAddresses"] = state?.secondaryPrivateIpAddresses; resourceInputs["subnetId"] = state?.subnetId; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; if (args?.subnetId === undefined && !opts.urn) { throw new Error("Missing required property 'subnetId'"); } resourceInputs["allocationId"] = args?.allocationId; resourceInputs["connectivityType"] = args?.connectivityType; resourceInputs["privateIp"] = args?.privateIp; resourceInputs["region"] = args?.region; resourceInputs["secondaryAllocationIds"] = args?.secondaryAllocationIds; resourceInputs["secondaryPrivateIpAddressCount"] = args?.secondaryPrivateIpAddressCount; resourceInputs["secondaryPrivateIpAddresses"] = args?.secondaryPrivateIpAddresses; resourceInputs["subnetId"] = args?.subnetId; resourceInputs["tags"] = args?.tags; 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