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

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_vpn_gateway"
     4  sidebar_current: "docs-google-compute-vpn-gateway"
     5  description: |-
     6    Manages a VPN Gateway in the GCE network
     7  ---
     8  
     9  # google\_compute\_vpn\_gateway
    10  
    11  Manages a VPN Gateway in the GCE network. For more info, read the
    12  [documentation](https://cloud.google.com/compute/docs/vpn).
    13  
    14  
    15  ## Example Usage
    16  
    17  ```hcl
    18  resource "google_compute_network" "network1" {
    19    name       = "network1"
    20    ipv4_range = "10.120.0.0/16"
    21  }
    22  
    23  resource "google_compute_vpn_gateway" "target_gateway" {
    24    name    = "vpn1"
    25    network = "${google_compute_network.network1.self_link}"
    26    region  = "${var.region}"
    27  }
    28  
    29  resource "google_compute_address" "vpn_static_ip" {
    30    name   = "vpn-static-ip"
    31    region = "${var.region}"
    32  }
    33  
    34  resource "google_compute_forwarding_rule" "fr_esp" {
    35    name        = "fr-esp"
    36    region      = "${var.region}"
    37    ip_protocol = "ESP"
    38    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    39    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    40  }
    41  
    42  resource "google_compute_forwarding_rule" "fr_udp500" {
    43    name        = "fr-udp500"
    44    region      = "${var.region}"
    45    ip_protocol = "UDP"
    46    port_range  = "500"
    47    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    48    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    49  }
    50  
    51  resource "google_compute_forwarding_rule" "fr_udp4500" {
    52    name        = "fr-udp4500"
    53    region      = "${var.region}"
    54    ip_protocol = "UDP"
    55    port_range  = "4500"
    56    ip_address  = "${google_compute_address.vpn_static_ip.address}"
    57    target      = "${google_compute_vpn_gateway.target_gateway.self_link}"
    58  }
    59  
    60  resource "google_compute_vpn_tunnel" "tunnel1" {
    61    name          = "tunnel1"
    62    region        = "${var.region}"
    63    peer_ip       = "15.0.0.120"
    64    shared_secret = "a secret message"
    65  
    66    target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
    67  
    68    depends_on = [
    69      "google_compute_forwarding_rule.fr_esp",
    70      "google_compute_forwarding_rule.fr_udp500",
    71      "google_compute_forwarding_rule.fr_udp4500",
    72    ]
    73  }
    74  
    75  resource "google_compute_route" "route1" {
    76    name       = "route1"
    77    network    = "${google_compute_network.network1.name}"
    78    dest_range = "15.0.0.0/24"
    79    priority   = 1000
    80  
    81    next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
    82  }
    83  ```
    84  
    85  ## Argument Reference
    86  
    87  The following arguments are supported:
    88  
    89  * `name` - (Required) A unique name for the resource, required by GCE. Changing
    90      this forces a new resource to be created.
    91  
    92  * `network` - (Required) The name or resource link to the network this VPN gateway
    93      is accepting traffic for. Changing this forces a new resource to be created.
    94  
    95  - - -
    96  
    97  * `description` - (Optional) A description of the resource.
    98      Changing this forces a new resource to be created.
    99  
   100  * `project` - (Optional) The project in which the resource belongs. If it
   101      is not provided, the provider project is used.
   102  
   103  * `region` - (Optional) The region this gateway should sit in. If not specified,
   104      the project region will be used. Changing this forces a new resource to be
   105      created.
   106  
   107  ## Attributes Reference
   108  
   109  In addition to the arguments listed above, the following computed attributes are
   110  exported:
   111  
   112  * `self_link` - The URI of the created resource.