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.self_link
  peer_network = google_compute_network.other.self_link
}

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

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:

Timeouts

This resource provides the following Timeouts configuration options: configuration options:

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

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

import {
  id = "{{project_id}}/{{network_id}}/{{peering_id}}"
  to = google_compute_network_peering.default
}

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

$ terraform import google_compute_network_peering.default {{project_id}}/{{network_id}}/{{peering_id}}