github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/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-resource-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  ```
    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      region = "${var.region}"
    26  }
    27  
    28  resource "google_compute_address" "vpn_static_ip" {
    29      name = "vpn-static-ip"
    30      region = "${var.region}"
    31  }
    32  
    33  resource "google_compute_forwarding_rule" "fr_esp" {
    34      name = "fr-esp"
    35      region = "${var.region}"
    36      ip_protocol = "ESP"
    37      ip_address = "${google_compute_address.vpn_static_ip.address}"
    38      target = "${google_compute_vpn_gateway.target_gateway.self_link}"
    39  }
    40  
    41  resource "google_compute_forwarding_rule" "fr_udp500" {
    42      name = "fr-udp500"
    43      region = "${var.region}"
    44      ip_protocol = "UDP"
    45      port_range = "500"
    46      ip_address = "${google_compute_address.vpn_static_ip.address}"
    47      target = "${google_compute_vpn_gateway.target_gateway.self_link}"
    48  }
    49  
    50  resource "google_compute_forwarding_rule" "fr_udp4500" {
    51      name = "fr-udp4500"
    52      region = "${var.region}"
    53      ip_protocol = "UDP"
    54      port_range = "4500"
    55      ip_address = "${google_compute_address.vpn_static_ip.address}"
    56      target = "${google_compute_vpn_gateway.target_gateway.self_link}"
    57  }
    58  
    59  resource "google_compute_vpn_tunnel" "tunnel1" {
    60      name = "tunnel1"
    61      region = "${var.region}"
    62      peer_ip = "15.0.0.120"
    63      shared_secret = "a secret message"
    64      target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
    65      depends_on = ["google_compute_forwarding_rule.fr_esp",
    66          "google_compute_forwarding_rule.fr_udp500",
    67          "google_compute_forwarding_rule.fr_udp4500"]
    68  }
    69  
    70  resource "google_compute_route" "route1" {
    71      name = "route1"
    72      network = "${google_compute_network.network1.name}"
    73      next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
    74      dest_range = "15.0.0.0/24"
    75      priority = 1000
    76  }
    77  
    78  ```
    79  
    80  ## Argument Reference
    81  
    82  The following arguments are supported:
    83  
    84  * `name` - (Required) A unique name for the resource, required by GCE.
    85      Changing this forces a new resource to be created.
    86  
    87  * `description` - (Optional) A description of the resource.
    88      Changing this forces a new resource to be created.
    89  
    90  * `peer_ip` - (Required) The VPN gateway sitting outside of GCE.
    91      Changing this forces a new resource to be created.
    92  
    93  * `region` - (Optional) The region this tunnel should sit in. If not specified,
    94      the project region will be used. Changing this forces a new resource to be 
    95      created.
    96  
    97  * `shared_secret` - (Required) A passphrase shared between the two VPN gateways.
    98      Changing this forces a new resource to be created.
    99  
   100  * `target_vpn_gateway` - (Required) A link to the VPN gateway sitting inside GCE.
   101      Changing this forces a new resource to be created.
   102  
   103  * `ike_version` - (Optional) Either version 1 or 2. Default is 2.
   104      Changing this forces a new resource to be created.
   105  
   106  ## Attributes Reference
   107  
   108  The following attributes are exported:
   109  
   110  * `self_link` - A GCE server assigned link to this resource.
   111  
   112  * `detailed_status` - Information about the status of the VPN tunnel.