@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
162 lines • 5.93 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.VPNGateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a VPN gateway running in GCP. This virtual device is managed
* by Google, but used only by you.
*
* To get more information about VpnGateway, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)
*
* > **Warning:** Classic VPN is deprecating certain functionality on October 31, 2021. For more information,
* see the [Classic VPN partial deprecation page](https://cloud.google.com/network-connectivity/docs/vpn/deprecations/classic-vpn-deprecation).
*
* ## Example Usage
*
* ### Target Vpn Gateway Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network1 = new gcp.compute.Network("network1", {name: "network-1"});
* const targetGateway = new gcp.compute.VPNGateway("target_gateway", {
* name: "vpn-1",
* network: network1.id,
* });
* const vpnStaticIp = new gcp.compute.Address("vpn_static_ip", {name: "vpn-static-ip"});
* const frEsp = new gcp.compute.ForwardingRule("fr_esp", {
* name: "fr-esp",
* ipProtocol: "ESP",
* ipAddress: vpnStaticIp.address,
* target: targetGateway.id,
* });
* const frUdp500 = new gcp.compute.ForwardingRule("fr_udp500", {
* name: "fr-udp500",
* ipProtocol: "UDP",
* portRange: "500",
* ipAddress: vpnStaticIp.address,
* target: targetGateway.id,
* });
* const frUdp4500 = new gcp.compute.ForwardingRule("fr_udp4500", {
* name: "fr-udp4500",
* ipProtocol: "UDP",
* portRange: "4500",
* ipAddress: vpnStaticIp.address,
* target: targetGateway.id,
* });
* const tunnel1 = new gcp.compute.VPNTunnel("tunnel1", {
* name: "tunnel1",
* peerIp: "15.0.0.120",
* sharedSecret: "a secret message",
* targetVpnGateway: targetGateway.id,
* }, {
* dependsOn: [
* frEsp,
* frUdp500,
* frUdp4500,
* ],
* });
* const route1 = new gcp.compute.Route("route1", {
* name: "route1",
* network: network1.name,
* destRange: "15.0.0.0/24",
* priority: 1000,
* nextHopVpnTunnel: tunnel1.id,
* });
* ```
*
* ## Import
*
* VpnGateway can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, VpnGateway can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/vPNGateway:VPNGateway default projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{name}}
* ```
*/
class VPNGateway extends pulumi.CustomResource {
/**
* Get an existing VPNGateway 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 VPNGateway(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VPNGateway. 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'] === VPNGateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["description"] = state?.description;
resourceInputs["gatewayId"] = state?.gatewayId;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["project"] = state?.project;
resourceInputs["region"] = state?.region;
resourceInputs["selfLink"] = state?.selfLink;
}
else {
const args = argsOrState;
if (args?.network === undefined && !opts.urn) {
throw new Error("Missing required property 'network'");
}
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["network"] = args?.network;
resourceInputs["project"] = args?.project;
resourceInputs["region"] = args?.region;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["gatewayId"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VPNGateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.VPNGateway = VPNGateway;
/** @internal */
VPNGateway.__pulumiType = 'gcp:compute/vPNGateway:VPNGateway';
//# sourceMappingURL=vpngateway.js.map
;