google_compute_network

Manages a VPC network or legacy network resource on GCP.

To get more information about Network, see:

Open in Cloud Shell

Example Usage - Network Basic

resource "google_compute_network" "vpc_network" {
  name = "vpc-network"
}

Example Usage - Network Custom Mtu

resource "google_compute_network" "vpc_network" {
  project                 = "my-project-name"
  name                    = "vpc-network"
  auto_create_subnetworks = true
  mtu                     = 1460
}

Example Usage - Network Custom Firewall Enforcement Order

resource "google_compute_network" "vpc_network" {
  project                                   = "my-project-name"
  name                                      = "vpc-network"
  auto_create_subnetworks                   = true
  network_firewall_policy_enforcement_order = "BEFORE_CLASSIC_FIREWALL"
}

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:

Import

Network can be imported using any of these accepted formats:

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

import {
  id = "projects/{{project}}/global/networks/{{name}}"
  to = google_compute_network.default
}

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

$ terraform import google_compute_network.default projects/{{project}}/global/networks/{{name}}
$ terraform import google_compute_network.default {{project}}/{{name}}
$ terraform import google_compute_network.default {{name}}

User Project Overrides

This resource supports User Project Overrides.