terraform-provider-google/website/docs/r/compute_network.html.markdown
Paddy c9fb64ed57 Unremove ipv4_range on networks.
We removed ipv4_range, but the API still exists, it's just deprecated.
This breaks configs for users that haven't migrated off yet. I added it
back, added some tests to use it, included it in the docs, and basically
tried to put things back the way they were. The main difference now is
that the auto_create_subnetworks field defaults to true, and we want to
keep that behaviour to avoid a breaking change. So now if users want to
use the lagacy API, they need to set auto_create_subnetworks to false
explicitly.
2017-11-29 15:03:36 -08:00

1.8 KiB

layout page_title sidebar_current description
google Google: google_compute_network docs-google-compute-network-x Manages a network within GCE.

google_compute_network

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

Example Usage

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

Argument Reference

The following arguments are supported:

  • name - (Required) A unique name for the resource, required by GCE. Changing this forces a new resource to be created.

  • auto_create_subnetworks - (Optional) If set to true, this network will be created in auto subnet mode, and Google will create a subnet for each region automatically. If set to false, a custom subnetted network will be created that can support google_compute_subnetwork resources. Defaults to true.

  • ipv4_range - (Optional) If set to a CIDR block, uses the legacy VPC API with the specified range. This API is deprecated. If set, auto_create_subnetworks must be explicitly set to false.

  • description - (Optional) A brief description of this resource.

  • project - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

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

  • gateway_ipv4 - The IPv4 address of the gateway.

  • name - The unique name of the network.

  • self_link - The URI of the created resource.

Import

Networks can be imported using the name, e.g.

$ terraform import google_compute_network.default foobar