@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
150 lines • 5.37 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VpcPeering = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* Provides a DigitalOcean VPC Peering resource.
*
* VPC Peerings are used to connect two VPC networks allowing resources in each
* VPC to communicate with each other privately.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example = new digitalocean.VpcPeering("example", {
* name: "example-peering",
* vpcIds: [
* vpc1.id,
* vpc2.id,
* ],
* });
* ```
*
* ### Resource Assignment
*
* You can use the VPC Peering resource to allow communication between resources
* in different VPCs. For example:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const vpc1 = new digitalocean.Vpc("vpc1", {
* name: "vpc1",
* region: "nyc3",
* });
* const vpc2 = new digitalocean.Vpc("vpc2", {
* name: "vpc2",
* region: "nyc3",
* });
* const example = new digitalocean.VpcPeering("example", {
* name: "example-peering",
* vpcIds: [
* vpc1.id,
* vpc2.id,
* ],
* });
* const example1 = new digitalocean.Droplet("example1", {
* name: "example1",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.NYC3,
* vpcUuid: vpc1.id,
* });
* const example2 = new digitalocean.Droplet("example2", {
* name: "example2",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.NYC3,
* vpcUuid: vpc2.id,
* });
* ```
*
* ## Import
*
* A VPC Peering can be imported using its `id`, e.g.
*
* ```sh
* $ pulumi import digitalocean:index/vpcPeering:VpcPeering example 771ad360-c017-4b4e-a34e-73934f5f0190
* ```
*/
class VpcPeering extends pulumi.CustomResource {
/**
* Get an existing VpcPeering 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 VpcPeering(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'digitalocean:index/vpcPeering:VpcPeering';
/**
* Returns true if the given object is an instance of VpcPeering. 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'] === VpcPeering.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["name"] = state?.name;
resourceInputs["status"] = state?.status;
resourceInputs["vpcIds"] = state?.vpcIds;
}
else {
const args = argsOrState;
if (args?.vpcIds === undefined && !opts.urn) {
throw new Error("Missing required property 'vpcIds'");
}
resourceInputs["name"] = args?.name;
resourceInputs["vpcIds"] = args?.vpcIds;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VpcPeering.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpcPeering = VpcPeering;
//# sourceMappingURL=vpcPeering.js.map