github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/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  ```js
    17  resource "google_compute_network" "network1" {
    18    name       = "network1"
    19    ipv4_range = "10.120.0.0/16"
    20  }
    21  
    22  resource "google_compute_vpn_gateway" "target_gateway" {
    23    name    = "vpn1"
    24    network = "${google_compute_network.network1.self_link}"
    25  }
    26  
    27  resource "google_compute_address" "vpn_static_ip" {
    28    name   = "vpn-static-ip"
    29  }
    30  
    31  resource "google_compute_forwarding_rule" "fr_esp" {
    32    name        = "fr-esp"
    33    ip_protocol = "ESP"
    34    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    35    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    36  }
    37  
    38  resource "google_compute_forwarding_rule" "fr_udp500" {
    39    name        = "fr-udp500"
    40    ip_protocol = "UDP"
    41    port_range  = "500"
    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_udp4500" {
    47    name        = "fr-udp4500"
    48    ip_protocol = "UDP"
    49    port_range  = "4500"
    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_vpn_tunnel" "tunnel1" {
    55    name          = "tunnel1"
    56    peer_ip       = "15.0.0.120"
    57    shared_secret = "a secret message"
    58  
    59    target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
    60  
    61    depends_on = [
    62      "google_compute_forwarding_rule.fr_esp",
    63      "google_compute_forwarding_rule.fr_udp500",
    64      "google_compute_forwarding_rule.fr_udp4500",
    65    ]
    66  }
    67  
    68  resource "google_compute_route" "route1" {
    69    name       = "route1"
    70    network    = "${google_compute_network.network1.name}"
    71    dest_range = "15.0.0.0/24"
    72    priority   = 1000
    73  
    74    next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
    75  }
    76  ```
    77  
    78  ## Argument Reference
    79  
    80  The following arguments are supported:
    81  
    82  * `name` - (Required) A unique name for the resource, required by GCE. Changing
    83      this forces a new resource to be created.
    84  
    85  * `peer_ip` - (Required) The VPN gateway sitting outside of GCE. Changing this
    86      forces a new resource to be created.
    87  
    88  * `shared_secret` - (Required) A passphrase shared between the two VPN gateways.
    89      Changing this forces a new resource to be created.
    90  
    91  * `target_vpn_gateway` - (Required) A link to the VPN gateway sitting inside
    92      GCE. Changing this forces a new resource to be created.
    93  
    94  - - -
    95  
    96  * `description` - (Optional) A description of the resource. Changing this forces
    97      a new resource to be created.
    98  
    99  * `ike_version` - (Optional) Either version 1 or 2. Default is 2. Changing this
   100      forces a new resource to be created.
   101  
   102  * `local_traffic_selector` - (Optional) Specifies which CIDR ranges are
   103      announced to the VPN peer. Mandatory if the VPN gateway is attached to a
   104      custom subnetted network. Refer to Google documentation for more
   105      information.
   106  
   107  * `project` - (Optional) The project in which the resource belongs. If it
   108      is not provided, the provider project is used.
   109  
   110  * `region` - (Optional) The region this tunnel should sit in. If not specified,
   111      the project region will be used. Changing this forces a new resource to be
   112      created.
   113  
   114  ## Attributes Reference
   115  
   116  In addition to the arguments listed above, the following computed attributes are
   117  exported:
   118  
   119  * `detailed_status` - Information about the status of the VPN tunnel.
   120  
   121  * `self_link` - The URI of the created resource.