terraform-provider-google/website/docs/r/compute_network.html.markdown
The Magician c662cc75ba Terraform: allow deletion of default route upon network creation (#3391)
<!-- This change is generated by MagicModules. -->
Original Author: @drebes
2019-04-05 15:17:23 -07:00

135 lines
4.8 KiB
Markdown

---
# ----------------------------------------------------------------------------
#
# *** 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.
#
# ----------------------------------------------------------------------------
layout: "google"
page_title: "Google: google_compute_network"
sidebar_current: "docs-google-compute-network"
description: |-
Manages a VPC network or legacy network resource on GCP.
---
# google\_compute\_network
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
```hcl
resource "google_compute_network" "vpc_network" {
name = "vpc-network"
}
```
## Argument Reference
The following arguments are supported:
* `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.
- - -
* `description` -
(Optional)
An optional description of this resource. The resource must be
recreated to modify this field.
* `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)
for more details.
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.
* `delete_default_routes_on_create`: If set to `true`, default routes (`0.0.0.0/0`) will be deleted
immediately after network creation. Defaults to `false`.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `gateway_ipv4` -
The gateway address for default routing out of the network. This value
is selected by GCP.
* `self_link` - The URI of the created resource.
## 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.
## Import
Network can be imported using any of these accepted formats:
```
$ 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}}
```
-> 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.