github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/google/r/compute_vpn_tunnel.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_vpn_tunnel"
     4  sidebar_current: "docs-google-compute-vpn-tunnel"
     5  description: |-
     6    Manages a VPN Tunnel to the GCE network
     7  ---
     8  
     9  # google\_compute\_vpn\_tunnel
    10  
    11  Manages a VPN Tunnel to the GCE network. For more info, read the
    12  [documentation](https://cloud.google.com/compute/docs/vpn).
    13  
    14  ## Example Usage
    15  
    16  ```hcl
    17  resource "google_compute_network" "network1" {
    18    name = "network1"
    19  }
    20  
    21  resource "google_compute_subnetwork" "subnet1" {
    22    name          = "subnet1"
    23    network       = "${google_compute_network.network1.self_link}"
    24    ip_cidr_range = "10.120.0.0/16"
    25    region        = "us-central1"
    26  }
    27  
    28  resource "google_compute_vpn_gateway" "target_gateway" {
    29    name    = "vpn1"
    30    network = "${google_compute_network.network1.self_link}"
    31    region  = "${google_compute_subnetwork.subnet1.region}"
    32  }
    33  
    34  resource "google_compute_address" "vpn_static_ip" {
    35    name   = "vpn-static-ip"
    36    region = "${google_compute_subnetwork.subnet1.region}"
    37  }
    38  
    39  resource "google_compute_forwarding_rule" "fr_esp" {
    40    name        = "fr-esp"
    41    ip_protocol = "ESP"
    42    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    43    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    44  }
    45  
    46  resource "google_compute_forwarding_rule" "fr_udp500" {
    47    name        = "fr-udp500"
    48    ip_protocol = "UDP"
    49    port_range  = "500-500"
    50    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    51    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    52  }
    53  
    54  resource "google_compute_forwarding_rule" "fr_udp4500" {
    55    name        = "fr-udp4500"
    56    ip_protocol = "UDP"
    57    port_range  = "4500-4500"
    58    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    59    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    60  }
    61  
    62  resource "google_compute_vpn_tunnel" "tunnel1" {
    63    name          = "tunnel1"
    64    peer_ip       = "15.0.0.120"
    65    shared_secret = "a secret message"
    66  
    67    target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
    68  
    69    local_traffic_selector  = ["${google_compute_subnetwork.subnet1.ip_cidr_range}"]
    70    remote_traffic_selector = ["172.16.0.0/12"]
    71  
    72    depends_on = [
    73      "google_compute_forwarding_rule.fr_esp",
    74      "google_compute_forwarding_rule.fr_udp500",
    75      "google_compute_forwarding_rule.fr_udp4500",
    76    ]
    77  }
    78  
    79  resource "google_compute_route" "route1" {
    80    name       = "route1"
    81    network    = "${google_compute_network.network1.name}"
    82    dest_range = "15.0.0.0/24"
    83    priority   = 1000
    84  
    85    next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
    86  }
    87  ```
    88  
    89  ## Argument Reference
    90  
    91  The following arguments are supported:
    92  
    93  * `name` - (Required) A unique name for the resource, required by GCE. Changing
    94      this forces a new resource to be created.
    95  
    96  * `peer_ip` - (Required) The VPN gateway sitting outside of GCE. Changing this
    97      forces a new resource to be created.
    98  
    99  * `shared_secret` - (Required) A passphrase shared between the two VPN gateways.
   100      Changing this forces a new resource to be created.
   101  
   102  * `target_vpn_gateway` - (Required) A link to the VPN gateway sitting inside
   103      GCE. Changing this forces a new resource to be created.
   104  
   105  - - -
   106  
   107  * `description` - (Optional) A description of the resource. Changing this forces
   108      a new resource to be created.
   109  
   110  * `ike_version` - (Optional) Either version 1 or 2. Default is 2. Changing this
   111      forces a new resource to be created.
   112  
   113  * `local_traffic_selector` - (Optional) Specifies which CIDR ranges are
   114      announced to the VPN peer. Mandatory if the VPN gateway is attached to a
   115      custom subnetted network. Refer to Google documentation for more
   116      information.
   117  
   118  * `remote_traffic_selector` - (Optional) Specifies which CIDR ranges the VPN
   119      tunnel can route to the remote side. Mandatory if the VPN gateway is attached to a
   120      custom subnetted network. Refer to Google documentation for more
   121      information.
   122  
   123  * `project` - (Optional) The project in which the resource belongs. If it
   124      is not provided, the provider project is used.
   125  
   126  * `region` - (Optional) The region this tunnel should sit in. If not specified,
   127      the project region will be used. Changing this forces a new resource to be
   128      created.
   129  
   130  ## Attributes Reference
   131  
   132  In addition to the arguments listed above, the following computed attributes are
   133  exported:
   134  
   135  * `detailed_status` - Information about the status of the VPN tunnel.
   136  
   137  * `self_link` - The URI of the created resource.