UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

149 lines 6.58 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! *** 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.NetworkPeering = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Manages a network peering within GCE. For more information see * [the official documentation](https://cloud.google.com/compute/docs/vpc/vpc-peering) * and * [API](https://cloud.google.com/compute/docs/reference/latest/networks). * * > Both networks must create a peering with each other for the peering * to be functional. * * > Subnets IP ranges across peered VPC networks cannot overlap. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "foobar", * autoCreateSubnetworks: false, * }); * const other = new gcp.compute.Network("other", { * name: "other", * autoCreateSubnetworks: false, * }); * const peering1 = new gcp.compute.NetworkPeering("peering1", { * name: "peering1", * network: _default.selfLink, * peerNetwork: other.selfLink, * }); * const peering2 = new gcp.compute.NetworkPeering("peering2", { * name: "peering2", * network: other.selfLink, * peerNetwork: _default.selfLink, * }); * ``` * * ## Import * * VPC network peerings can be imported using the name and project of the primary network the peering exists in and the name of the network peering * * * `{{project_id}}/{{network_id}}/{{peering_id}}` * * When using the `pulumi import` command, VPC network peerings can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/networkPeering:NetworkPeering default {{project_id}}/{{network_id}}/{{peering_id}} * ``` */ class NetworkPeering extends pulumi.CustomResource { /** * Get an existing NetworkPeering 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 NetworkPeering(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/networkPeering:NetworkPeering'; /** * Returns true if the given object is an instance of NetworkPeering. 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'] === NetworkPeering.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["exportCustomRoutes"] = state?.exportCustomRoutes; resourceInputs["exportSubnetRoutesWithPublicIp"] = state?.exportSubnetRoutesWithPublicIp; resourceInputs["importCustomRoutes"] = state?.importCustomRoutes; resourceInputs["importSubnetRoutesWithPublicIp"] = state?.importSubnetRoutesWithPublicIp; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["peerNetwork"] = state?.peerNetwork; resourceInputs["stackType"] = state?.stackType; resourceInputs["state"] = state?.state; resourceInputs["stateDetails"] = state?.stateDetails; resourceInputs["updateStrategy"] = state?.updateStrategy; } else { const args = argsOrState; if (args?.network === undefined && !opts.urn) { throw new Error("Missing required property 'network'"); } if (args?.peerNetwork === undefined && !opts.urn) { throw new Error("Missing required property 'peerNetwork'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["exportCustomRoutes"] = args?.exportCustomRoutes; resourceInputs["exportSubnetRoutesWithPublicIp"] = args?.exportSubnetRoutesWithPublicIp; resourceInputs["importCustomRoutes"] = args?.importCustomRoutes; resourceInputs["importSubnetRoutesWithPublicIp"] = args?.importSubnetRoutesWithPublicIp; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["peerNetwork"] = args?.peerNetwork; resourceInputs["stackType"] = args?.stackType; resourceInputs["updateStrategy"] = args?.updateStrategy; resourceInputs["state"] = undefined /*out*/; resourceInputs["stateDetails"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(NetworkPeering.__pulumiType, name, resourceInputs, opts); } } exports.NetworkPeering = NetworkPeering; //# sourceMappingURL=networkPeering.js.map