github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/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-resource-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 ``` 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 target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}" 66 depends_on = ["google_compute_forwarding_rule.fr_esp", 67 "google_compute_forwarding_rule.fr_udp500", 68 "google_compute_forwarding_rule.fr_udp4500"] 69 } 70 71 resource "google_compute_route" "route1" { 72 name = "route1" 73 network = "${google_compute_network.network1.name}" 74 next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}" 75 dest_range = "15.0.0.0/24" 76 priority = 1000 77 } 78 79 ``` 80 81 ## Argument Reference 82 83 The following arguments are supported: 84 85 * `name` - (Required) A unique name for the resource, required by GCE. 86 Changing this forces a new resource to be created. 87 88 * `description` - (Optional) A description of the resource. 89 Changing this forces a new resource to be created. 90 91 * `network` - (Required) A link to the network this VPN gateway is accepting 92 traffic for. 93 Changing this forces a new resource to be created. 94 95 * `region` - (Optional) The region this gateway should sit in. If not specified, 96 the project region will be used. Changing this forces a new resource to be 97 created. 98 99 ## Attributes Reference 100 101 The following attributes are exported: 102 103 * `self_link` - A GCE server assigned link to this resource.