2015-09-04 20:54:18 +00:00
|
|
|
---
|
2018-06-29 23:27:01 +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.
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
2015-09-04 20:54:18 +00:00
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_vpn_tunnel"
|
2015-10-23 14:10:41 +00:00
|
|
|
sidebar_current: "docs-google-compute-vpn-tunnel"
|
2015-09-04 20:54:18 +00:00
|
|
|
description: |-
|
2018-06-29 23:27:01 +00:00
|
|
|
VPN tunnel resource.
|
2015-09-04 20:54:18 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_vpn\_tunnel
|
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
VPN tunnel resource.
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-10-04 02:45:53 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
To get more information about VpnTunnel, see:
|
|
|
|
|
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)
|
|
|
|
* How-to Guides
|
|
|
|
* [Cloud VPN Overview](https://cloud.google.com/vpn/docs/concepts/overview)
|
|
|
|
* [Networks and Tunnel Routing](https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)
|
|
|
|
|
|
|
|
~> **Warning:** All arguments including the shared secret will be stored in the raw
|
|
|
|
state as plain-text.
|
2017-10-10 11:54:47 +00:00
|
|
|
[Read more about sensitive data in state](/docs/state/sensitive-data.html).
|
|
|
|
|
2018-10-19 16:18:25 +00:00
|
|
|
<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=vpn_tunnel_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 - Vpn Tunnel Basic
|
|
|
|
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2018-10-05 19:32:57 +00:00
|
|
|
resource "google_compute_vpn_tunnel" "tunnel1" {
|
|
|
|
name = "tunnel1"
|
|
|
|
peer_ip = "15.0.0.120"
|
|
|
|
shared_secret = "a secret message"
|
|
|
|
|
|
|
|
target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
2017-01-27 23:43:45 +00:00
|
|
|
|
2018-10-05 19:32:57 +00:00
|
|
|
depends_on = [
|
|
|
|
"google_compute_forwarding_rule.fr_esp",
|
|
|
|
"google_compute_forwarding_rule.fr_udp500",
|
|
|
|
"google_compute_forwarding_rule.fr_udp4500",
|
|
|
|
]
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_vpn_gateway" "target_gateway" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "vpn1"
|
|
|
|
network = "${google_compute_network.network1.self_link}"
|
2018-10-05 19:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_network" "network1" {
|
|
|
|
name = "network1"
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_address" "vpn_static_ip" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "vpn-static-ip"
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_forwarding_rule" "fr_esp" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "fr-esp"
|
|
|
|
ip_protocol = "ESP"
|
|
|
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
|
|
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_forwarding_rule" "fr_udp500" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "fr-udp500"
|
|
|
|
ip_protocol = "UDP"
|
2018-10-05 19:32:57 +00:00
|
|
|
port_range = "500"
|
2016-04-10 21:34:15 +00:00
|
|
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
|
|
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_forwarding_rule" "fr_udp4500" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "fr-udp4500"
|
|
|
|
ip_protocol = "UDP"
|
2018-10-05 19:32:57 +00:00
|
|
|
port_range = "4500"
|
2016-04-10 21:34:15 +00:00
|
|
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
|
|
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
2015-09-04 20:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_route" "route1" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "route1"
|
|
|
|
network = "${google_compute_network.network1.name}"
|
|
|
|
dest_range = "15.0.0.0/24"
|
|
|
|
priority = 1000
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
|
|
|
|
}
|
2015-09-04 20:54:18 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `name` -
|
|
|
|
(Required)
|
|
|
|
Name of the resource. 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.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `target_vpn_gateway` -
|
|
|
|
(Required)
|
|
|
|
URL of the Target VPN gateway with which this VPN tunnel is
|
|
|
|
associated.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `peer_ip` -
|
|
|
|
(Required)
|
|
|
|
IP address of the peer VPN gateway. Only IPv4 is supported.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `shared_secret` -
|
|
|
|
(Required)
|
|
|
|
Shared secret used to set the secure session between the Cloud VPN
|
|
|
|
gateway and the peer VPN gateway.
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-08-20 23:46:13 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
- - -
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `description` -
|
|
|
|
(Optional)
|
|
|
|
An optional description of this resource.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `router` -
|
|
|
|
(Optional)
|
|
|
|
URL of router resource to be used for dynamic routing.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `ike_version` -
|
|
|
|
(Optional)
|
|
|
|
IKE protocol version to use when establishing the VPN tunnel with
|
|
|
|
peer VPN gateway.
|
|
|
|
Acceptable IKE versions are 1 or 2. Default version is 2.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `local_traffic_selector` -
|
|
|
|
(Optional)
|
|
|
|
Local traffic selector to use when establishing the VPN tunnel with
|
|
|
|
peer VPN gateway. The value should be a CIDR formatted string,
|
|
|
|
for example `192.168.0.0/16`. The ranges should be disjoint.
|
|
|
|
Only IPv4 is supported.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `remote_traffic_selector` -
|
|
|
|
(Optional)
|
|
|
|
Remote traffic selector to use when establishing the VPN tunnel with
|
|
|
|
peer VPN gateway. The value should be a CIDR formatted string,
|
|
|
|
for example `192.168.0.0/16`. The ranges should be disjoint.
|
|
|
|
Only IPv4 is supported.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `labels` -
|
|
|
|
(Optional)
|
|
|
|
Labels to apply to this VpnTunnel.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `region` -
|
|
|
|
(Optional)
|
2018-12-12 17:04:33 +00:00
|
|
|
The region where the tunnel is located. If unset, is set to the region of `target_vpn_gateway`.
|
2018-08-17 23:33:38 +00:00
|
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
2018-06-29 23:27:01 +00:00
|
|
|
If it is not provided, the provider project is used.
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2016-03-31 10:37:17 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
## Attributes Reference
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
|
|
|
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `creation_timestamp` -
|
|
|
|
Creation timestamp in RFC3339 text format.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `shared_secret_hash` -
|
|
|
|
Hash of the shared secret.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `label_fingerprint` -
|
|
|
|
The fingerprint used for optimistic locking of this resource. Used
|
|
|
|
internally during updates.
|
2018-08-08 00:55:45 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
* `detailed_status` -
|
|
|
|
Detailed status message for the VPN tunnel.
|
|
|
|
* `self_link` - The URI of the created resource.
|
2017-01-04 09:35:44 +00:00
|
|
|
|
2017-04-28 19:17:08 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
## Timeouts
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
This resource provides the following
|
|
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
- `create` - Default is 4 minutes.
|
|
|
|
- `update` - Default is 4 minutes.
|
|
|
|
- `delete` - Default is 4 minutes.
|
2016-04-10 21:34:15 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
## Import
|
2015-09-04 20:54:18 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
VpnTunnel can be imported using any of these accepted formats:
|
2016-04-10 21:34:15 +00:00
|
|
|
|
2018-06-29 23:27:01 +00:00
|
|
|
```
|
|
|
|
$ terraform import google_compute_vpn_tunnel.default projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}
|
|
|
|
$ terraform import google_compute_vpn_tunnel.default {{project}}/{{region}}/{{name}}
|
|
|
|
$ terraform import google_compute_vpn_tunnel.default {{name}}
|
|
|
|
```
|