UNPKG

@pulumi/gcp

Version:

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

270 lines • 10.6 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.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, * }); * ``` * ### Vpn Tunnel Cipher Suite * * ```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-cipher", * peerIp: "15.0.0.120", * sharedSecret: "a secret message", * targetVpnGateway: targetGateway.id, * cipherSuite: { * phase1: { * encryptions: ["AES-CBC-256"], * integrities: ["HMAC-SHA2-256-128"], * prves: ["PRF-HMAC-SHA2-256"], * dhs: ["Group-14"], * }, * phase2: { * encryptions: ["AES-CBC-128"], * integrities: ["HMAC-SHA2-256-128"], * pfs: ["Group-14"], * }, * }, * 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, { ...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["cipherSuite"] = state?.cipherSuite; resourceInputs["creationTimestamp"] = state?.creationTimestamp; resourceInputs["description"] = state?.description; resourceInputs["detailedStatus"] = state?.detailedStatus; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["ikeVersion"] = state?.ikeVersion; resourceInputs["labelFingerprint"] = state?.labelFingerprint; resourceInputs["labels"] = state?.labels; resourceInputs["localTrafficSelectors"] = state?.localTrafficSelectors; resourceInputs["name"] = state?.name; resourceInputs["peerExternalGateway"] = state?.peerExternalGateway; resourceInputs["peerExternalGatewayInterface"] = state?.peerExternalGatewayInterface; resourceInputs["peerGcpGateway"] = state?.peerGcpGateway; resourceInputs["peerIp"] = state?.peerIp; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["region"] = state?.region; resourceInputs["remoteTrafficSelectors"] = state?.remoteTrafficSelectors; resourceInputs["router"] = state?.router; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["sharedSecret"] = state?.sharedSecret; resourceInputs["sharedSecretHash"] = state?.sharedSecretHash; resourceInputs["targetVpnGateway"] = state?.targetVpnGateway; resourceInputs["tunnelId"] = state?.tunnelId; resourceInputs["vpnGateway"] = state?.vpnGateway; resourceInputs["vpnGatewayInterface"] = state?.vpnGatewayInterface; } else { const args = argsOrState; if (args?.sharedSecret === undefined && !opts.urn) { throw new Error("Missing required property 'sharedSecret'"); } resourceInputs["cipherSuite"] = args?.cipherSuite; resourceInputs["description"] = args?.description; resourceInputs["ikeVersion"] = args?.ikeVersion; resourceInputs["labels"] = args?.labels; resourceInputs["localTrafficSelectors"] = args?.localTrafficSelectors; resourceInputs["name"] = args?.name; resourceInputs["peerExternalGateway"] = args?.peerExternalGateway; resourceInputs["peerExternalGatewayInterface"] = args?.peerExternalGatewayInterface; resourceInputs["peerGcpGateway"] = args?.peerGcpGateway; resourceInputs["peerIp"] = args?.peerIp; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["remoteTrafficSelectors"] = args?.remoteTrafficSelectors; resourceInputs["router"] = args?.router; resourceInputs["sharedSecret"] = args?.sharedSecret ? pulumi.secret(args.sharedSecret) : undefined; resourceInputs["targetVpnGateway"] = args?.targetVpnGateway; resourceInputs["vpnGateway"] = args?.vpnGateway; resourceInputs["vpnGatewayInterface"] = args?.vpnGatewayInterface; 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