@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
200 lines • 9.29 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VPNTunnel = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* VPN tunnel resource.
*
* To get more information about VpnTunnel, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)
* * How-to Guides
* * [Cloud VPN Overview](https://cloud.google.com/vpn/docs/concepts/overview)
* * [Networks and Tunnel Routing](https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)
*
* ## Example Usage
*
* ### Vpn Tunnel 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: "tunnel-1",
* peerIp: "15.0.0.120",
* sharedSecret: "a secret message",
* targetVpnGateway: targetGateway.id,
* labels: {
* foo: "bar",
* },
* }, {
* 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
*
* VpnTunnel can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, VpnTunnel can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/vPNTunnel:VPNTunnel default projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{name}}
* ```
*/
class VPNTunnel extends pulumi.CustomResource {
/**
* Get an existing VPNTunnel 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 VPNTunnel(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of VPNTunnel. 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'] === VPNTunnel.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["detailedStatus"] = state ? state.detailedStatus : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["ikeVersion"] = state ? state.ikeVersion : undefined;
resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["localTrafficSelectors"] = state ? state.localTrafficSelectors : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["peerExternalGateway"] = state ? state.peerExternalGateway : undefined;
resourceInputs["peerExternalGatewayInterface"] = state ? state.peerExternalGatewayInterface : undefined;
resourceInputs["peerGcpGateway"] = state ? state.peerGcpGateway : undefined;
resourceInputs["peerIp"] = state ? state.peerIp : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["remoteTrafficSelectors"] = state ? state.remoteTrafficSelectors : undefined;
resourceInputs["router"] = state ? state.router : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["sharedSecret"] = state ? state.sharedSecret : undefined;
resourceInputs["sharedSecretHash"] = state ? state.sharedSecretHash : undefined;
resourceInputs["targetVpnGateway"] = state ? state.targetVpnGateway : undefined;
resourceInputs["tunnelId"] = state ? state.tunnelId : undefined;
resourceInputs["vpnGateway"] = state ? state.vpnGateway : undefined;
resourceInputs["vpnGatewayInterface"] = state ? state.vpnGatewayInterface : undefined;
}
else {
const args = argsOrState;
if ((!args || args.sharedSecret === undefined) && !opts.urn) {
throw new Error("Missing required property 'sharedSecret'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["ikeVersion"] = args ? args.ikeVersion : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["localTrafficSelectors"] = args ? args.localTrafficSelectors : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["peerExternalGateway"] = args ? args.peerExternalGateway : undefined;
resourceInputs["peerExternalGatewayInterface"] = args ? args.peerExternalGatewayInterface : undefined;
resourceInputs["peerGcpGateway"] = args ? args.peerGcpGateway : undefined;
resourceInputs["peerIp"] = args ? args.peerIp : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["remoteTrafficSelectors"] = args ? args.remoteTrafficSelectors : undefined;
resourceInputs["router"] = args ? args.router : undefined;
resourceInputs["sharedSecret"] = (args === null || args === void 0 ? void 0 : args.sharedSecret) ? pulumi.secret(args.sharedSecret) : undefined;
resourceInputs["targetVpnGateway"] = args ? args.targetVpnGateway : undefined;
resourceInputs["vpnGateway"] = args ? args.vpnGateway : undefined;
resourceInputs["vpnGatewayInterface"] = args ? args.vpnGatewayInterface : undefined;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["detailedStatus"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["labelFingerprint"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["sharedSecretHash"] = undefined /*out*/;
resourceInputs["tunnelId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels", "sharedSecret"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(VPNTunnel.__pulumiType, name, resourceInputs, opts);
}
}
exports.VPNTunnel = VPNTunnel;
/** @internal */
VPNTunnel.__pulumiType = 'gcp:compute/vPNTunnel:VPNTunnel';
//# sourceMappingURL=vpntunnel.js.map