@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
97 lines • 4.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.EipAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an AWS EIP Association as a top level resource, to associate and disassociate Elastic IPs from AWS Instances and Network Interfaces.
*
* > **NOTE:** Do not use this resource to associate an EIP to `aws.lb.LoadBalancer` or `aws.ec2.NatGateway` resources. Instead use the `allocationId` available in those resources to allow AWS to manage the association, otherwise you will see `AuthFailure` errors.
*
* > **NOTE:** `aws.ec2.EipAssociation` is useful in scenarios where EIPs are either pre-existing or distributed to customers or users and therefore cannot be changed.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const web = new aws.ec2.Instance("web", {
* ami: "ami-21f78e11",
* availabilityZone: "us-west-2a",
* instanceType: aws.ec2.InstanceType.T2_Micro,
* tags: {
* Name: "HelloWorld",
* },
* });
* const example = new aws.ec2.Eip("example", {domain: "vpc"});
* const eipAssoc = new aws.ec2.EipAssociation("eip_assoc", {
* instanceId: web.id,
* allocationId: example.id,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import EIP Assocations using their association IDs. For example:
*
* ```sh
* $ pulumi import aws:ec2/eipAssociation:EipAssociation test eipassoc-ab12c345
* ```
*/
class EipAssociation extends pulumi.CustomResource {
/**
* Get an existing EipAssociation 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 EipAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of EipAssociation. 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'] === EipAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allocationId"] = state?.allocationId;
resourceInputs["allowReassociation"] = state?.allowReassociation;
resourceInputs["instanceId"] = state?.instanceId;
resourceInputs["networkInterfaceId"] = state?.networkInterfaceId;
resourceInputs["privateIpAddress"] = state?.privateIpAddress;
resourceInputs["publicIp"] = state?.publicIp;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
resourceInputs["allocationId"] = args?.allocationId;
resourceInputs["allowReassociation"] = args?.allowReassociation;
resourceInputs["instanceId"] = args?.instanceId;
resourceInputs["networkInterfaceId"] = args?.networkInterfaceId;
resourceInputs["privateIpAddress"] = args?.privateIpAddress;
resourceInputs["publicIp"] = args?.publicIp;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(EipAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.EipAssociation = EipAssociation;
/** @internal */
EipAssociation.__pulumiType = 'aws:ec2/eipAssociation:EipAssociation';
//# sourceMappingURL=eipAssociation.js.map