@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
95 lines • 4.19 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.StaticIpAttachment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a static IP address attachment - relationship between a Lightsail static IP and Lightsail instance.
*
* Use this resource to attach a static IP address to a Lightsail instance to provide a consistent public IP address that persists across instance restarts.
*
* > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.StaticIp("example", {name: "example"});
* const exampleInstance = new aws.lightsail.Instance("example", {
* name: "example",
* availabilityZone: "us-east-1a",
* blueprintId: "ubuntu_20_04",
* bundleId: "nano_2_0",
* });
* const exampleStaticIpAttachment = new aws.lightsail.StaticIpAttachment("example", {
* staticIpName: example.id,
* instanceName: exampleInstance.id,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_lightsail_static_ip_attachment` using the static IP name. For example:
*
* ```sh
* $ pulumi import aws:lightsail/staticIpAttachment:StaticIpAttachment example example-static-ip
* ```
*/
class StaticIpAttachment extends pulumi.CustomResource {
/**
* Get an existing StaticIpAttachment 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 StaticIpAttachment(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of StaticIpAttachment. 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'] === StaticIpAttachment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["instanceName"] = state?.instanceName;
resourceInputs["ipAddress"] = state?.ipAddress;
resourceInputs["region"] = state?.region;
resourceInputs["staticIpName"] = state?.staticIpName;
}
else {
const args = argsOrState;
if (args?.instanceName === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceName'");
}
if (args?.staticIpName === undefined && !opts.urn) {
throw new Error("Missing required property 'staticIpName'");
}
resourceInputs["instanceName"] = args?.instanceName;
resourceInputs["region"] = args?.region;
resourceInputs["staticIpName"] = args?.staticIpName;
resourceInputs["ipAddress"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(StaticIpAttachment.__pulumiType, name, resourceInputs, opts);
}
}
exports.StaticIpAttachment = StaticIpAttachment;
/** @internal */
StaticIpAttachment.__pulumiType = 'aws:lightsail/staticIpAttachment:StaticIpAttachment';
//# sourceMappingURL=staticIpAttachment.js.map