UNPKG

@pulumi/gcp

Version:

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

239 lines • 9.44 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.HaVpnGateway = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Represents a VPN gateway running in GCP. This virtual device is managed * by Google, but used only by you. This type of VPN Gateway allows for the creation * of VPN solutions with higher availability than classic Target VPN Gateways. * * To get more information about HaVpnGateway, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/vpnGateways) * * How-to Guides * * [Choosing a VPN](https://cloud.google.com/vpn/docs/how-to/choosing-a-vpn) * * [Cloud VPN Overview](https://cloud.google.com/vpn/docs/concepts/overview) * * ## Example Usage * * ### Ha Vpn Gateway Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network1 = new gcp.compute.Network("network1", { * name: "network1", * autoCreateSubnetworks: false, * }); * const haGateway1 = new gcp.compute.HaVpnGateway("ha_gateway1", { * region: "us-central1", * name: "ha-vpn-1", * network: network1.id, * }); * ``` * ### Ha Vpn Gateway Ipv6 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network1 = new gcp.compute.Network("network1", { * name: "network1", * autoCreateSubnetworks: false, * }); * const haGateway1 = new gcp.compute.HaVpnGateway("ha_gateway1", { * region: "us-central1", * name: "ha-vpn-1", * network: network1.id, * stackType: "IPV4_IPV6", * labels: { * mykey: "myvalue", * }, * }); * ``` * ### Compute Ha Vpn Gateway Encrypted Interconnect * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network = new gcp.compute.Network("network", { * name: "test-network", * autoCreateSubnetworks: false, * }); * const address1 = new gcp.compute.Address("address1", { * name: "test-address1", * addressType: "INTERNAL", * purpose: "IPSEC_INTERCONNECT", * address: "192.168.1.0", * prefixLength: 29, * network: network.selfLink, * }); * const router = new gcp.compute.Router("router", { * name: "test-router", * network: network.name, * encryptedInterconnectRouter: true, * bgp: { * asn: 16550, * }, * }); * const attachment1 = new gcp.compute.InterconnectAttachment("attachment1", { * name: "test-interconnect-attachment1", * edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1", * type: "PARTNER", * router: router.id, * encryption: "IPSEC", * ipsecInternalAddresses: [address1.selfLink], * }); * const address2 = new gcp.compute.Address("address2", { * name: "test-address2", * addressType: "INTERNAL", * purpose: "IPSEC_INTERCONNECT", * address: "192.168.2.0", * prefixLength: 29, * network: network.selfLink, * }); * const attachment2 = new gcp.compute.InterconnectAttachment("attachment2", { * name: "test-interconnect-attachment2", * edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_2", * type: "PARTNER", * router: router.id, * encryption: "IPSEC", * ipsecInternalAddresses: [address2.selfLink], * }); * const vpn_gateway = new gcp.compute.HaVpnGateway("vpn-gateway", { * name: "test-ha-vpngw", * network: network.id, * vpnInterfaces: [ * { * id: 0, * interconnectAttachment: attachment1.selfLink, * }, * { * id: 1, * interconnectAttachment: attachment2.selfLink, * }, * ], * }); * ``` * * ## Import * * HaVpnGateway can be imported using any of these accepted formats: * * * `projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}` * * `{{project}}/{{region}}/{{name}}` * * `{{region}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, HaVpnGateway can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/haVpnGateway:HaVpnGateway default projects/{{project}}/regions/{{region}}/vpnGateways/{{name}} * $ pulumi import gcp:compute/haVpnGateway:HaVpnGateway default {{project}}/{{region}}/{{name}} * $ pulumi import gcp:compute/haVpnGateway:HaVpnGateway default {{region}}/{{name}} * $ pulumi import gcp:compute/haVpnGateway:HaVpnGateway default {{name}} * ``` */ class HaVpnGateway extends pulumi.CustomResource { /** * Get an existing HaVpnGateway 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 HaVpnGateway(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/haVpnGateway:HaVpnGateway'; /** * Returns true if the given object is an instance of HaVpnGateway. 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'] === HaVpnGateway.__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["gatewayIpVersion"] = state?.gatewayIpVersion; resourceInputs["labelFingerprint"] = state?.labelFingerprint; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["params"] = state?.params; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["region"] = state?.region; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["stackType"] = state?.stackType; resourceInputs["vpnInterfaces"] = state?.vpnInterfaces; } else { const args = argsOrState; if (args?.network === undefined && !opts.urn) { throw new Error("Missing required property 'network'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["gatewayIpVersion"] = args?.gatewayIpVersion; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["params"] = args?.params; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["stackType"] = args?.stackType; resourceInputs["vpnInterfaces"] = args?.vpnInterfaces; 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(HaVpnGateway.__pulumiType, name, resourceInputs, opts); } } exports.HaVpnGateway = HaVpnGateway; //# sourceMappingURL=haVpnGateway.js.map