@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
564 lines • 19.8 kB
JavaScript
"use strict";
// *** 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.Spoke = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The NetworkConnectivity Spoke resource
*
* To get more information about Spoke, see:
*
* * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1beta/projects.locations.spokes)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/overview)
*
* ## Example Usage
*
* ### Network Connectivity Spoke Linked Vpc Network Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "net",
* autoCreateSubnetworks: false,
* });
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "hub1",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "spoke1",
* location: "global",
* description: "A sample spoke with a linked router appliance instance",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedVpcNetwork: {
* excludeExportRanges: [
* "198.51.100.0/24",
* "10.10.0.0/16",
* ],
* includeExportRanges: [
* "198.51.100.0/23",
* "10.0.0.0/8",
* ],
* uri: network.selfLink,
* },
* });
* ```
* ### Network Connectivity Spoke Linked Vpc Network Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "net-spoke",
* autoCreateSubnetworks: false,
* });
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "hub1-spoke",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const defaultGroup = new gcp.networkconnectivity.Group("default_group", {
* hub: basicHub.id,
* name: "default",
* description: "A sample hub group",
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "group-spoke1",
* location: "global",
* description: "A sample spoke with a linked VPC",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedVpcNetwork: {
* excludeExportRanges: [
* "198.51.100.0/24",
* "10.10.0.0/16",
* ],
* includeExportRanges: [
* "198.51.100.0/23",
* "10.0.0.0/8",
* ],
* uri: network.selfLink,
* },
* group: defaultGroup.id,
* });
* ```
* ### Network Connectivity Spoke Router Appliance Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "tf-test-network_91980",
* autoCreateSubnetworks: false,
* });
* const subnetwork = new gcp.compute.Subnetwork("subnetwork", {
* name: "tf-test-subnet_37118",
* ipCidrRange: "10.0.0.0/28",
* region: "us-central1",
* network: network.selfLink,
* });
* const instance = new gcp.compute.Instance("instance", {
* name: "tf-test-instance_80332",
* machineType: "e2-medium",
* canIpForward: true,
* zone: "us-central1-a",
* bootDisk: {
* initializeParams: {
* image: "projects/debian-cloud/global/images/debian-10-buster-v20210817",
* },
* },
* networkInterfaces: [{
* subnetwork: subnetwork.name,
* networkIp: "10.0.0.2",
* accessConfigs: [{
* networkTier: "PREMIUM",
* }],
* }],
* });
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "tf-test-hub_13293",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "tf-test-name_40289",
* location: "us-central1",
* description: "A sample spoke with a linked routher appliance instance",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedRouterApplianceInstances: {
* instances: [{
* virtualMachine: instance.selfLink,
* ipAddress: "10.0.0.2",
* }],
* siteToSiteDataTransfer: true,
* includeImportRanges: ["ALL_IPV4_RANGES"],
* },
* });
* ```
* ### Network Connectivity Spoke Vpn Tunnel Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "basic-hub1",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const network = new gcp.compute.Network("network", {
* name: "basic-network",
* autoCreateSubnetworks: false,
* });
* const subnetwork = new gcp.compute.Subnetwork("subnetwork", {
* name: "basic-subnetwork",
* ipCidrRange: "10.0.0.0/28",
* region: "us-central1",
* network: network.selfLink,
* });
* const gateway = new gcp.compute.HaVpnGateway("gateway", {
* name: "vpn-gateway",
* network: network.id,
* });
* const externalVpnGw = new gcp.compute.ExternalVpnGateway("external_vpn_gw", {
* name: "external-vpn-gateway",
* redundancyType: "SINGLE_IP_INTERNALLY_REDUNDANT",
* description: "An externally managed VPN gateway",
* interfaces: [{
* id: 0,
* ipAddress: "8.8.8.8",
* }],
* });
* const router = new gcp.compute.Router("router", {
* name: "external-vpn-gateway",
* region: "us-central1",
* network: network.name,
* bgp: {
* asn: 64514,
* },
* });
* const tunnel1 = new gcp.compute.VPNTunnel("tunnel1", {
* name: "tunnel1",
* region: "us-central1",
* vpnGateway: gateway.id,
* peerExternalGateway: externalVpnGw.id,
* peerExternalGatewayInterface: 0,
* sharedSecret: "a secret message",
* router: router.id,
* vpnGatewayInterface: 0,
* });
* const tunnel2 = new gcp.compute.VPNTunnel("tunnel2", {
* name: "tunnel2",
* region: "us-central1",
* vpnGateway: gateway.id,
* peerExternalGateway: externalVpnGw.id,
* peerExternalGatewayInterface: 0,
* sharedSecret: "a secret message",
* router: pulumi.interpolate` ${router.id}`,
* vpnGatewayInterface: 1,
* });
* const routerInterface1 = new gcp.compute.RouterInterface("router_interface1", {
* name: "router-interface1",
* router: router.name,
* region: "us-central1",
* ipRange: "169.254.0.1/30",
* vpnTunnel: tunnel1.name,
* });
* const routerPeer1 = new gcp.compute.RouterPeer("router_peer1", {
* name: "router-peer1",
* router: router.name,
* region: "us-central1",
* peerIpAddress: "169.254.0.2",
* peerAsn: 64515,
* advertisedRoutePriority: 100,
* "interface": routerInterface1.name,
* });
* const routerInterface2 = new gcp.compute.RouterInterface("router_interface2", {
* name: "router-interface2",
* router: router.name,
* region: "us-central1",
* ipRange: "169.254.1.1/30",
* vpnTunnel: tunnel2.name,
* });
* const routerPeer2 = new gcp.compute.RouterPeer("router_peer2", {
* name: "router-peer2",
* router: router.name,
* region: "us-central1",
* peerIpAddress: "169.254.1.2",
* peerAsn: 64515,
* advertisedRoutePriority: 100,
* "interface": routerInterface2.name,
* });
* const tunnel1Spoke = new gcp.networkconnectivity.Spoke("tunnel1", {
* name: "vpn-tunnel-1-spoke",
* location: "us-central1",
* description: "A sample spoke with a linked VPN Tunnel",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedVpnTunnels: {
* uris: [tunnel1.selfLink],
* siteToSiteDataTransfer: true,
* includeImportRanges: ["ALL_IPV4_RANGES"],
* },
* });
* const tunnel2Spoke = new gcp.networkconnectivity.Spoke("tunnel2", {
* name: "vpn-tunnel-2-spoke",
* location: "us-central1",
* description: "A sample spoke with a linked VPN Tunnel",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedVpnTunnels: {
* uris: [tunnel2.selfLink],
* siteToSiteDataTransfer: true,
* includeImportRanges: ["ALL_IPV4_RANGES"],
* },
* });
* ```
* ### Network Connectivity Spoke Interconnect Attachment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "basic-hub1",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const network = new gcp.compute.Network("network", {
* name: "basic-network",
* autoCreateSubnetworks: false,
* });
* const router = new gcp.compute.Router("router", {
* name: "external-vpn-gateway",
* region: "us-central1",
* network: network.name,
* bgp: {
* asn: 16550,
* },
* });
* const interconnect_attachment = new gcp.compute.InterconnectAttachment("interconnect-attachment", {
* name: "partner-interconnect1",
* edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1",
* type: "PARTNER",
* router: router.id,
* mtu: "1500",
* region: "us-central1",
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "interconnect-attachment-spoke",
* location: "us-central1",
* description: "A sample spoke with a linked Interconnect Attachment",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedInterconnectAttachments: {
* uris: [interconnect_attachment.selfLink],
* siteToSiteDataTransfer: true,
* includeImportRanges: ["ALL_IPV4_RANGES"],
* },
* });
* ```
* ### Network Connectivity Spoke Linked Producer Vpc Network Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "net-spoke",
* autoCreateSubnetworks: false,
* });
* const address = new gcp.compute.GlobalAddress("address", {
* name: "test-address",
* purpose: "VPC_PEERING",
* addressType: "INTERNAL",
* prefixLength: 16,
* network: network.id,
* });
* const peering = new gcp.servicenetworking.Connection("peering", {
* network: network.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [address.name],
* });
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {name: "hub-basic"});
* const linkedVpcSpoke = new gcp.networkconnectivity.Spoke("linked_vpc_spoke", {
* name: "vpc-spoke",
* location: "global",
* hub: basicHub.id,
* linkedVpcNetwork: {
* uri: network.selfLink,
* },
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "producer-spoke",
* location: "global",
* description: "A sample spoke with a linked router appliance instance",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedProducerVpcNetwork: {
* network: network.name,
* peering: peering.peering,
* excludeExportRanges: [
* "198.51.100.0/24",
* "10.10.0.0/16",
* ],
* },
* }, {
* dependsOn: [linkedVpcSpoke],
* });
* ```
* ### Network Connectivity Spoke Center Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "tf-net",
* autoCreateSubnetworks: false,
* });
* const starHub = new gcp.networkconnectivity.Hub("star_hub", {
* name: "hub-basic",
* presetTopology: "STAR",
* });
* const centerGroup = new gcp.networkconnectivity.Group("center_group", {
* name: "center",
* hub: starHub.id,
* autoAccept: {
* autoAcceptProjects: [
* "foo_33395",
* "bar_76044",
* ],
* },
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "vpc-spoke",
* location: "global",
* description: "A sample spoke",
* labels: {
* "label-one": "value-one",
* },
* hub: starHub.id,
* group: centerGroup.id,
* linkedVpcNetwork: {
* uri: network.selfLink,
* },
* });
* ```
* ### Network Connectivity Spoke Linked Vpc Network Ipv6 Support
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const network = new gcp.compute.Network("network", {
* name: "net",
* autoCreateSubnetworks: false,
* });
* const basicHub = new gcp.networkconnectivity.Hub("basic_hub", {
* name: "hub1",
* description: "A sample hub",
* labels: {
* "label-two": "value-one",
* },
* });
* const primary = new gcp.networkconnectivity.Spoke("primary", {
* name: "spoke1-ipv6",
* location: "global",
* description: "A sample spoke with a linked VPC that include export ranges of all IPv6",
* labels: {
* "label-one": "value-one",
* },
* hub: basicHub.id,
* linkedVpcNetwork: {
* includeExportRanges: [
* "ALL_IPV6_RANGES",
* "ALL_PRIVATE_IPV4_RANGES",
* ],
* uri: network.selfLink,
* },
* });
* ```
*
* ## Import
*
* Spoke can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/spokes/{{name}}`
*
* * `{{project}}/{{location}}/{{name}}`
*
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, Spoke can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:networkconnectivity/spoke:Spoke default projects/{{project}}/locations/{{location}}/spokes/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkconnectivity/spoke:Spoke default {{project}}/{{location}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkconnectivity/spoke:Spoke default {{location}}/{{name}}
* ```
*/
class Spoke extends pulumi.CustomResource {
/**
* Get an existing Spoke 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 Spoke(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Spoke. 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'] === Spoke.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["group"] = state ? state.group : undefined;
resourceInputs["hub"] = state ? state.hub : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["linkedInterconnectAttachments"] = state ? state.linkedInterconnectAttachments : undefined;
resourceInputs["linkedProducerVpcNetwork"] = state ? state.linkedProducerVpcNetwork : undefined;
resourceInputs["linkedRouterApplianceInstances"] = state ? state.linkedRouterApplianceInstances : undefined;
resourceInputs["linkedVpcNetwork"] = state ? state.linkedVpcNetwork : undefined;
resourceInputs["linkedVpnTunnels"] = state ? state.linkedVpnTunnels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["uniqueId"] = state ? state.uniqueId : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.hub === undefined) && !opts.urn) {
throw new Error("Missing required property 'hub'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["group"] = args ? args.group : undefined;
resourceInputs["hub"] = args ? args.hub : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["linkedInterconnectAttachments"] = args ? args.linkedInterconnectAttachments : undefined;
resourceInputs["linkedProducerVpcNetwork"] = args ? args.linkedProducerVpcNetwork : undefined;
resourceInputs["linkedRouterApplianceInstances"] = args ? args.linkedRouterApplianceInstances : undefined;
resourceInputs["linkedVpcNetwork"] = args ? args.linkedVpcNetwork : undefined;
resourceInputs["linkedVpnTunnels"] = args ? args.linkedVpnTunnels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["uniqueId"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Spoke.__pulumiType, name, resourceInputs, opts);
}
}
exports.Spoke = Spoke;
/** @internal */
Spoke.__pulumiType = 'gcp:networkconnectivity/spoke:Spoke';
//# sourceMappingURL=spoke.js.map