UNPKG

@pulumi/gcp

Version:

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

219 lines • 8.77 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.ExternalVpnGateway = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Represents a VPN gateway managed outside of GCP. * * To get more information about ExternalVpnGateway, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/externalVpnGateways) * * ## Example Usage * * ### External Vpn Gateway * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network = new gcp.compute.Network("network", { * name: "network-1", * routingMode: "GLOBAL", * autoCreateSubnetworks: false, * }); * const haGateway = new gcp.compute.HaVpnGateway("ha_gateway", { * region: "us-central1", * name: "ha-vpn", * network: network.id, * }); * const externalGateway = new gcp.compute.ExternalVpnGateway("external_gateway", { * name: "external-gateway", * redundancyType: "SINGLE_IP_INTERNALLY_REDUNDANT", * description: "An externally managed VPN gateway", * interfaces: [{ * id: 0, * ipAddress: "8.8.8.8", * }], * }); * const networkSubnet1 = new gcp.compute.Subnetwork("network_subnet1", { * name: "ha-vpn-subnet-1", * ipCidrRange: "10.0.1.0/24", * region: "us-central1", * network: network.id, * }); * const networkSubnet2 = new gcp.compute.Subnetwork("network_subnet2", { * name: "ha-vpn-subnet-2", * ipCidrRange: "10.0.2.0/24", * region: "us-west1", * network: network.id, * }); * const router1 = new gcp.compute.Router("router1", { * name: "ha-vpn-router1", * network: network.name, * bgp: { * asn: 64514, * }, * }); * const tunnel1 = new gcp.compute.VPNTunnel("tunnel1", { * name: "ha-vpn-tunnel1", * region: "us-central1", * vpnGateway: haGateway.id, * peerExternalGateway: externalGateway.id, * peerExternalGatewayInterface: 0, * sharedSecret: "a secret message", * router: router1.id, * vpnGatewayInterface: 0, * }); * const tunnel2 = new gcp.compute.VPNTunnel("tunnel2", { * name: "ha-vpn-tunnel2", * region: "us-central1", * vpnGateway: haGateway.id, * peerExternalGateway: externalGateway.id, * peerExternalGatewayInterface: 0, * sharedSecret: "a secret message", * router: pulumi.interpolate` ${router1.id}`, * vpnGatewayInterface: 1, * }); * const router1Interface1 = new gcp.compute.RouterInterface("router1_interface1", { * name: "router1-interface1", * router: router1.name, * region: "us-central1", * ipRange: "169.254.0.1/30", * vpnTunnel: tunnel1.name, * }); * const router1Peer1 = new gcp.compute.RouterPeer("router1_peer1", { * name: "router1-peer1", * router: router1.name, * region: "us-central1", * peerIpAddress: "169.254.0.2", * peerAsn: 64515, * advertisedRoutePriority: 100, * "interface": router1Interface1.name, * }); * const router1Interface2 = new gcp.compute.RouterInterface("router1_interface2", { * name: "router1-interface2", * router: router1.name, * region: "us-central1", * ipRange: "169.254.1.1/30", * vpnTunnel: tunnel2.name, * }); * const router1Peer2 = new gcp.compute.RouterPeer("router1_peer2", { * name: "router1-peer2", * router: router1.name, * region: "us-central1", * peerIpAddress: "169.254.1.2", * peerAsn: 64515, * advertisedRoutePriority: 100, * "interface": router1Interface2.name, * }); * ``` * * ## Import * * ExternalVpnGateway can be imported using any of these accepted formats: * * * `projects/{{project}}/global/externalVpnGateways/{{name}}` * * `{{project}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, ExternalVpnGateway can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default projects/{{project}}/global/externalVpnGateways/{{name}} * $ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default {{project}}/{{name}} * $ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default {{name}} * ``` */ class ExternalVpnGateway extends pulumi.CustomResource { /** * Get an existing ExternalVpnGateway 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 ExternalVpnGateway(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/externalVpnGateway:ExternalVpnGateway'; /** * Returns true if the given object is an instance of ExternalVpnGateway. 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'] === ExternalVpnGateway.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["interfaces"] = state?.interfaces; resourceInputs["labelFingerprint"] = state?.labelFingerprint; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["params"] = state?.params; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["redundancyType"] = state?.redundancyType; resourceInputs["selfLink"] = state?.selfLink; } else { const args = argsOrState; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["interfaces"] = args?.interfaces; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["params"] = args?.params; resourceInputs["project"] = args?.project; resourceInputs["redundancyType"] = args?.redundancyType; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["labelFingerprint"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ExternalVpnGateway.__pulumiType, name, resourceInputs, opts); } } exports.ExternalVpnGateway = ExternalVpnGateway; //# sourceMappingURL=externalVpnGateway.js.map