UNPKG

@pulumi/gcp

Version:

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

754 lines (753 loc) • 26.4 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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_59033", * autoCreateSubnetworks: false, * }); * const subnetwork = new gcp.compute.Subnetwork("subnetwork", { * name: "tf-test-subnet_32081", * ipCidrRange: "10.0.0.0/28", * region: "us-central1", * network: network.selfLink, * }); * const instance = new gcp.compute.Instance("instance", { * name: "tf-test-instance_10393", * 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_33052", * description: "A sample hub", * labels: { * "label-two": "value-one", * }, * }); * const primary = new gcp.networkconnectivity.Spoke("primary", { * name: "tf-test-name_3684", * 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_10719", * "bar_1443", * ], * }, * }); * 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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: SpokeState, opts?: pulumi.CustomResourceOptions): Spoke; /** * 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: any): obj is Spoke; /** * Output only. The time the spoke was created. */ readonly createTime: pulumi.Output<string>; /** * An optional description of the spoke. */ readonly description: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * The name of the group that this spoke is associated with. */ readonly group: pulumi.Output<string>; /** * Immutable. The URI of the hub that this spoke is attached to. */ readonly hub: pulumi.Output<string>; /** * Optional labels in key:value format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A collection of VLAN attachment resources. These resources should be redundant attachments that all advertise the same prefixes to Google Cloud. Alternatively, in active/passive configurations, all attachments should be capable of advertising the same prefixes. * Structure is documented below. */ readonly linkedInterconnectAttachments: pulumi.Output<outputs.networkconnectivity.SpokeLinkedInterconnectAttachments | undefined>; /** * Producer VPC network that is associated with the spoke. * Structure is documented below. */ readonly linkedProducerVpcNetwork: pulumi.Output<outputs.networkconnectivity.SpokeLinkedProducerVpcNetwork | undefined>; /** * The URIs of linked Router appliance resources * Structure is documented below. */ readonly linkedRouterApplianceInstances: pulumi.Output<outputs.networkconnectivity.SpokeLinkedRouterApplianceInstances | undefined>; /** * VPC network that is associated with the spoke. * Structure is documented below. */ readonly linkedVpcNetwork: pulumi.Output<outputs.networkconnectivity.SpokeLinkedVpcNetwork | undefined>; /** * The URIs of linked VPN tunnel resources * Structure is documented below. */ readonly linkedVpnTunnels: pulumi.Output<outputs.networkconnectivity.SpokeLinkedVpnTunnels | undefined>; /** * The location for the resource */ readonly location: pulumi.Output<string>; /** * Immutable. The name of the spoke. Spoke names must be unique. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The reasons for the current state in the lifecycle * Structure is documented below. */ readonly reasons: pulumi.Output<outputs.networkconnectivity.SpokeReason[]>; /** * Output only. The current lifecycle state of this spoke. */ readonly state: pulumi.Output<string>; /** * Output only. The Google-generated UUID for the spoke. This value is unique across all spoke resources. If a spoke is deleted and another with the same name is created, the new spoke is assigned a different unique_id. */ readonly uniqueId: pulumi.Output<string>; /** * Output only. The time the spoke was last updated. */ readonly updateTime: pulumi.Output<string>; /** * Create a Spoke resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SpokeArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Spoke resources. */ export interface SpokeState { /** * Output only. The time the spoke was created. */ createTime?: pulumi.Input<string>; /** * An optional description of the spoke. */ description?: pulumi.Input<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The name of the group that this spoke is associated with. */ group?: pulumi.Input<string>; /** * Immutable. The URI of the hub that this spoke is attached to. */ hub?: pulumi.Input<string>; /** * Optional labels in key:value format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A collection of VLAN attachment resources. These resources should be redundant attachments that all advertise the same prefixes to Google Cloud. Alternatively, in active/passive configurations, all attachments should be capable of advertising the same prefixes. * Structure is documented below. */ linkedInterconnectAttachments?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedInterconnectAttachments>; /** * Producer VPC network that is associated with the spoke. * Structure is documented below. */ linkedProducerVpcNetwork?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedProducerVpcNetwork>; /** * The URIs of linked Router appliance resources * Structure is documented below. */ linkedRouterApplianceInstances?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedRouterApplianceInstances>; /** * VPC network that is associated with the spoke. * Structure is documented below. */ linkedVpcNetwork?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedVpcNetwork>; /** * The URIs of linked VPN tunnel resources * Structure is documented below. */ linkedVpnTunnels?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedVpnTunnels>; /** * The location for the resource */ location?: pulumi.Input<string>; /** * Immutable. The name of the spoke. Spoke names must be unique. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The reasons for the current state in the lifecycle * Structure is documented below. */ reasons?: pulumi.Input<pulumi.Input<inputs.networkconnectivity.SpokeReason>[]>; /** * Output only. The current lifecycle state of this spoke. */ state?: pulumi.Input<string>; /** * Output only. The Google-generated UUID for the spoke. This value is unique across all spoke resources. If a spoke is deleted and another with the same name is created, the new spoke is assigned a different unique_id. */ uniqueId?: pulumi.Input<string>; /** * Output only. The time the spoke was last updated. */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a Spoke resource. */ export interface SpokeArgs { /** * An optional description of the spoke. */ description?: pulumi.Input<string>; /** * The name of the group that this spoke is associated with. */ group?: pulumi.Input<string>; /** * Immutable. The URI of the hub that this spoke is attached to. */ hub: pulumi.Input<string>; /** * Optional labels in key:value format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A collection of VLAN attachment resources. These resources should be redundant attachments that all advertise the same prefixes to Google Cloud. Alternatively, in active/passive configurations, all attachments should be capable of advertising the same prefixes. * Structure is documented below. */ linkedInterconnectAttachments?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedInterconnectAttachments>; /** * Producer VPC network that is associated with the spoke. * Structure is documented below. */ linkedProducerVpcNetwork?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedProducerVpcNetwork>; /** * The URIs of linked Router appliance resources * Structure is documented below. */ linkedRouterApplianceInstances?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedRouterApplianceInstances>; /** * VPC network that is associated with the spoke. * Structure is documented below. */ linkedVpcNetwork?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedVpcNetwork>; /** * The URIs of linked VPN tunnel resources * Structure is documented below. */ linkedVpnTunnels?: pulumi.Input<inputs.networkconnectivity.SpokeLinkedVpnTunnels>; /** * The location for the resource */ location: pulumi.Input<string>; /** * Immutable. The name of the spoke. Spoke names must be unique. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; }