UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

129 lines 4.75 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.VpcPeering = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * > VPC peering is currently in alpha. If you are not a member of the alpha group for this feature, you will not be able to use it until it has been more widely released. Please follow the official [DigitalOcean changelog](https://docs.digitalocean.com/release-notes/) for updates. * * 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.createdAt : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["vpcIds"] = state ? state.vpcIds : undefined; } else { const args = argsOrState; if ((!args || args.vpcIds === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcIds'"); } resourceInputs["name"] = args ? args.name : undefined; resourceInputs["vpcIds"] = args ? args.vpcIds : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VpcPeering.__pulumiType, name, resourceInputs, opts); } } exports.VpcPeering = VpcPeering; /** @internal */ VpcPeering.__pulumiType = 'digitalocean:index/vpcPeering:VpcPeering'; //# sourceMappingURL=vpcPeering.js.map