2014-08-26 21:50:29 +00:00
|
|
|
---
|
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_network"
|
2017-08-07 17:13:55 +00:00
|
|
|
sidebar_current: "docs-google-compute-network-x"
|
2014-10-22 03:21:56 +00:00
|
|
|
description: |-
|
|
|
|
Manages a network within GCE.
|
2014-08-26 21:50:29 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_network
|
|
|
|
|
2017-07-28 18:05:48 +00:00
|
|
|
Manages a network within GCE. For more information see
|
|
|
|
[the official documentation](https://cloud.google.com/compute/docs/vpc)
|
|
|
|
and
|
|
|
|
[API](https://cloud.google.com/compute/docs/reference/latest/networks).
|
2014-08-26 21:50:29 +00:00
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2014-08-26 21:50:29 +00:00
|
|
|
resource "google_compute_network" "default" {
|
2017-06-14 00:02:27 +00:00
|
|
|
name = "foobar"
|
2016-12-15 12:37:13 +00:00
|
|
|
auto_create_subnetworks = "true"
|
2014-08-26 21:50:29 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 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.
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
- - -
|
|
|
|
|
|
|
|
* `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
|
2017-09-28 22:51:31 +00:00
|
|
|
automatically. If set to false, a custom subnetted network will be created that
|
2017-11-29 23:00:51 +00:00
|
|
|
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.
|
2016-04-10 21:34:15 +00:00
|
|
|
|
2017-12-12 19:29:50 +00:00
|
|
|
* `routing_mode` - (Optional) Sets the network-wide routing mode for Cloud Routers
|
|
|
|
to use. Accepted values are `"GLOBAL"` or `"REGIONAL"`. Defaults to `"REGIONAL"`.
|
|
|
|
Refer to the [Cloud Router documentation](https://cloud.google.com/router/docs/concepts/overview#dynamic-routing-mode)
|
|
|
|
for more details.
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `description` - (Optional) A brief description of this resource.
|
2016-03-31 10:37:17 +00:00
|
|
|
|
2018-03-12 20:59:47 +00:00
|
|
|
* `project` - (Optional) The ID of the project in which the resource belongs. If it
|
2016-04-10 21:34:15 +00:00
|
|
|
is not provided, the provider project is used.
|
2014-08-26 21:50:29 +00:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are
|
|
|
|
exported:
|
2014-08-26 21:50:29 +00:00
|
|
|
|
|
|
|
* `gateway_ipv4` - The IPv4 address of the gateway.
|
2016-04-10 21:34:15 +00:00
|
|
|
|
2017-03-27 15:47:06 +00:00
|
|
|
* `name` - The unique name of the network.
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `self_link` - The URI of the created resource.
|
2017-04-21 09:51:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
Networks can be imported using the `name`, e.g.
|
|
|
|
|
|
|
|
```
|
2017-06-14 00:02:27 +00:00
|
|
|
$ terraform import google_compute_network.default foobar
|
|
|
|
```
|