google_network_connectivity_spoke

The NetworkConnectivity Spoke resource

Example Usage - linked_vpc_network

resource "google_compute_network" "network" {
  name                    = "network"
  auto_create_subnetworks = false
}

resource "google_network_connectivity_hub" "basic_hub" {
  name        = "hub"
  description = "A sample hub"
  labels = {
    label-two = "value-one"
  }
}

resource "google_network_connectivity_spoke" "primary" {
  name = "name"
  location = "global"
  description = "A sample spoke with a linked routher appliance instance"
  labels = {
    label-one = "value-one"
  }
  hub = google_network_connectivity_hub.basic_hub.id
  linked_vpc_network {
    exclude_export_ranges = [
      "198.51.100.0/24",
      "10.10.0.0/16"
    ]
    uri = google_compute_network.network.self_link
  }
}

Example Usage - router_appliance

resource "google_compute_network" "network" {
  name                    = "network"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "subnetwork" {
  name          = "subnet"
  ip_cidr_range = "10.0.0.0/28"
  region        = "us-west1"
  network       = google_compute_network.network.self_link
}

resource "google_compute_instance" "instance" {
  name         = "instance"
  machine_type = "e2-medium"
  can_ip_forward = true
  zone         = "us-west1-a"

  boot_disk {
    initialize_params {
      image = "projects/debian-cloud/global/images/debian-10-buster-v20210817"
    }
  }

  network_interface {
    subnetwork = google_compute_subnetwork.subnetwork.name
    network_ip = "10.0.0.2"
    access_config {
        network_tier = "PREMIUM"
    }
  }
}

resource "google_network_connectivity_hub" "basic_hub" {
  name        = "hub"
  description = "A sample hub"
  labels = {
    label-two = "value-one"
  }
}

resource "google_network_connectivity_spoke" "primary" {
  name = "name"
  location = "us-west1"
  description = "A sample spoke with a linked routher appliance instance"
  labels = {
    label-one = "value-one"
  }
  hub =  google_network_connectivity_hub.basic_hub.id
  linked_router_appliance_instances {
    instances {
        virtual_machine = google_compute_instance.instance.self_link
        ip_address = "10.0.0.2"
    }
    site_to_site_data_transfer = true
  }
}

Argument Reference

The following arguments are supported:

The instances block supports:


Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

The linked_interconnect_attachments block supports:

The linked_router_appliance_instances block supports:

The linked_vpc_network block supports:

The linked_vpn_tunnels block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Spoke can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Spoke using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/spokes/{{name}}"
  to = google_network_connectivity_spoke.default
}

When using the terraform import command, Spoke can be imported using one of the formats above. For example:

$ terraform import google_network_connectivity_spoke.default projects/{{project}}/locations/{{location}}/spokes/{{name}}
$ terraform import google_network_connectivity_spoke.default {{project}}/{{location}}/{{name}}
$ terraform import google_network_connectivity_spoke.default {{location}}/{{name}}