...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Compute-ComputeVpnTunnel-vpn_tunnel_basic/main.tf

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Compute-ComputeVpnTunnel-vpn_tunnel_basic

     1/**
     2 * Copyright 2022 Google LLC
     3 *
     4 * Licensed under the Apache License, Version 2.0 (the "License");
     5 * you may not use this file except in compliance with the License.
     6 * You may obtain a copy of the License at
     7 *
     8 *      http://www.apache.org/licenses/LICENSE-2.0
     9 *
    10 * Unless required by applicable law or agreed to in writing, software
    11 * distributed under the License is distributed on an "AS IS" BASIS,
    12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 * See the License for the specific language governing permissions and
    14 * limitations under the License.
    15 */
    16
    17```hcl
    18resource "google_compute_vpn_tunnel" "tunnel1" {
    19  name          = "tunnel-1"
    20  peer_ip       = "15.0.0.120"
    21  shared_secret = "a secret message"
    22
    23  target_vpn_gateway = google_compute_vpn_gateway.target_gateway.id
    24
    25  depends_on = [
    26    google_compute_forwarding_rule.fr_esp,
    27    google_compute_forwarding_rule.fr_udp500,
    28    google_compute_forwarding_rule.fr_udp4500,
    29  ]
    30}
    31
    32resource "google_compute_vpn_gateway" "target_gateway" {
    33  name    = "vpn-1"
    34  network = google_compute_network.network1.id
    35}
    36
    37resource "google_compute_network" "network1" {
    38  name = "network-1"
    39}
    40
    41resource "google_compute_address" "vpn_static_ip" {
    42  name = "vpn-static-ip"
    43}
    44
    45resource "google_compute_forwarding_rule" "fr_esp" {
    46  name        = "fr-esp"
    47  ip_protocol = "ESP"
    48  ip_address  = google_compute_address.vpn_static_ip.address
    49  target      = google_compute_vpn_gateway.target_gateway.id
    50}
    51
    52resource "google_compute_forwarding_rule" "fr_udp500" {
    53  name        = "fr-udp500"
    54  ip_protocol = "UDP"
    55  port_range  = "500"
    56  ip_address  = google_compute_address.vpn_static_ip.address
    57  target      = google_compute_vpn_gateway.target_gateway.id
    58}
    59
    60resource "google_compute_forwarding_rule" "fr_udp4500" {
    61  name        = "fr-udp4500"
    62  ip_protocol = "UDP"
    63  port_range  = "4500"
    64  ip_address  = google_compute_address.vpn_static_ip.address
    65  target      = google_compute_vpn_gateway.target_gateway.id
    66}
    67
    68resource "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.id
    75}
    76```

View as plain text