2014-08-26 21:50:29 +00:00
|
|
|
---
|
2019-03-08 16:34:57 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# This file is automatically generated by Magic Modules and manual
|
|
|
|
# changes will be clobbered when the file is regenerated.
|
|
|
|
#
|
|
|
|
# Please read more about how to change this file in
|
|
|
|
# .github/CONTRIBUTING.md.
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
2014-08-26 21:50:29 +00:00
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_network"
|
2019-03-08 16:34:57 +00:00
|
|
|
sidebar_current: "docs-google-compute-network"
|
2014-10-22 03:21:56 +00:00
|
|
|
description: |-
|
2019-03-08 16:34:57 +00:00
|
|
|
Manages a VPC network or legacy network resource on GCP.
|
2014-08-26 21:50:29 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_network
|
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
Manages a VPC network or legacy network resource on GCP.
|
|
|
|
|
|
|
|
|
|
|
|
To get more information about Network, see:
|
|
|
|
|
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/networks)
|
|
|
|
* How-to Guides
|
|
|
|
* [Official Documentation](https://cloud.google.com/vpc/docs/vpc)
|
|
|
|
|
|
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=network_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
## Example Usage - Network Basic
|
2014-08-26 21:50:29 +00:00
|
|
|
|
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2019-03-08 16:34:57 +00:00
|
|
|
resource "google_compute_network" "vpc_network" {
|
|
|
|
name = "vpc-network"
|
2014-08-26 21:50:29 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
|
|
|
|
* `name` -
|
|
|
|
(Required)
|
|
|
|
Name of the resource. Provided by the client when the resource is
|
|
|
|
created. The name must be 1-63 characters long, and comply with
|
|
|
|
RFC1035. Specifically, the name must be 1-63 characters long and match
|
|
|
|
the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the
|
|
|
|
first character must be a lowercase letter, and all following
|
|
|
|
characters must be a dash, lowercase letter, or digit, except the last
|
|
|
|
character, which cannot be a dash.
|
|
|
|
|
2014-08-26 21:50:29 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
- - -
|
|
|
|
|
2017-11-29 23:00:51 +00:00
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
* `description` -
|
|
|
|
(Optional)
|
|
|
|
An optional description of this resource. The resource must be
|
|
|
|
recreated to modify this field.
|
2018-10-23 19:30:00 +00:00
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
* `ipv4_range` -
|
|
|
|
(Optional, Deprecated)
|
|
|
|
If this field is specified, a deprecated legacy network is created.
|
|
|
|
You will no longer be able to create a legacy network on Feb 1, 2020.
|
|
|
|
See the [legacy network docs](https://cloud.google.com/vpc/docs/legacy)
|
2017-12-12 19:29:50 +00:00
|
|
|
for more details.
|
2019-03-08 16:34:57 +00:00
|
|
|
The range of internal addresses that are legal on this legacy network.
|
|
|
|
This range is a CIDR specification, for example: `192.168.0.0/16`.
|
|
|
|
The resource must be recreated to modify this field.
|
|
|
|
|
|
|
|
* `auto_create_subnetworks` -
|
|
|
|
(Optional)
|
|
|
|
When set to `true`, the network is created in "auto subnet mode" and
|
|
|
|
it will create a subnet for each region automatically across the
|
|
|
|
`10.128.0.0/9` address range.
|
|
|
|
When set to `false`, the network is created in "custom subnet mode" so
|
|
|
|
the user can explicitly connect subnetwork resources.
|
|
|
|
|
|
|
|
* `routing_mode` -
|
|
|
|
(Optional)
|
|
|
|
The network-wide routing mode to use. If set to `REGIONAL`, this
|
|
|
|
network's cloud routers will only advertise routes with subnetworks
|
|
|
|
of this network in the same region as the router. If set to `GLOBAL`,
|
|
|
|
this network's cloud routers will advertise routes with all
|
|
|
|
subnetworks of this network, across regions.
|
|
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
|
|
|
If it is not provided, the provider project is used.
|
2017-12-12 19:29:50 +00:00
|
|
|
|
2014-08-26 21:50:29 +00:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
2016-04-10 21:34:15 +00:00
|
|
|
|
2017-03-27 15:47:06 +00:00
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
* `gateway_ipv4` -
|
|
|
|
The gateway address for default routing out of the network. This value
|
|
|
|
is selected by GCP.
|
2016-04-10 21:34:15 +00:00
|
|
|
* `self_link` - The URI of the created resource.
|
2017-04-21 09:51:24 +00:00
|
|
|
|
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
## Timeouts
|
|
|
|
|
|
|
|
This resource provides the following
|
|
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
|
|
|
|
- `create` - Default is 4 minutes.
|
|
|
|
- `update` - Default is 4 minutes.
|
|
|
|
- `delete` - Default is 4 minutes.
|
|
|
|
|
2017-04-21 09:51:24 +00:00
|
|
|
## Import
|
|
|
|
|
2019-03-08 16:34:57 +00:00
|
|
|
Network can be imported using any of these accepted formats:
|
2017-04-21 09:51:24 +00:00
|
|
|
|
|
|
|
```
|
2019-03-08 16:34:57 +00:00
|
|
|
$ 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}}
|
2017-06-14 00:02:27 +00:00
|
|
|
```
|
2019-03-08 16:34:57 +00:00
|
|
|
|
|
|
|
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
|
|
|
|
as an argument so that Terraform uses the correct provider to import your resource.
|