» google_compute_network_peering

Manages a network peering within GCE. For more information see the official documentation and API.

» Example Usage

resource "google_compute_network_peering" "peering1" {
  name         = "peering1"
  network      = google_compute_network.default.id
  peer_network = google_compute_network.other.id
}

resource "google_compute_network_peering" "peering2" {
  name         = "peering2"
  network      = google_compute_network.other.id
  peer_network = google_compute_network.default.id
}

resource "google_compute_network" "default" {
  name                    = "foobar"
  auto_create_subnetworks = "false"
}

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

» Argument Reference

The following arguments are supported:

» Attributes Reference

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

  • id - an identifier for the resource with format {{network}}/{{name}}

  • state - State for the peering, either ACTIVE or INACTIVE. The peering is ACTIVE when there's a matching configuration in the peer network.

  • state_details - Details about the current state of the peering.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

VPC network peerings can be imported using the name and project of the primary network the peering exists in and the name of the network peering

$ terraform import google_compute_network_peering.peering_network project-name/network-name/peering-name