mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
108 lines
3.1 KiB
Go
108 lines
3.1 KiB
Go
![]() |
// ----------------------------------------------------------------------------
|
||
|
//
|
||
|
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||
|
//
|
||
|
// ----------------------------------------------------------------------------
|
||
|
//
|
||
|
// This file is automatically generated by Magic Modules and manual
|
||
|
// changes will be clobbered when the file is regenerated.
|
||
|
//
|
||
|
// Please read more about how to change this file in
|
||
|
// .github/CONTRIBUTING.md.
|
||
|
//
|
||
|
// ----------------------------------------------------------------------------
|
||
|
|
||
|
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestAccComputeVpnGateway_targetVpnGatewayBasicExample(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
CheckDestroy: testAccCheckComputeVpnGatewayDestroy,
|
||
|
Steps: []resource.TestStep{
|
||
|
{
|
||
|
Config: testAccComputeVpnGateway_targetVpnGatewayBasicExample(acctest.RandString(10)),
|
||
|
},
|
||
|
{
|
||
|
ResourceName: "google_compute_vpn_gateway.target_gateway",
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func testAccComputeVpnGateway_targetVpnGatewayBasicExample(val string) string {
|
||
|
return fmt.Sprintf(`
|
||
|
resource "google_compute_vpn_gateway" "target_gateway" {
|
||
|
name = "vpn1-%s"
|
||
|
network = "${google_compute_network.network1.self_link}"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_network" "network1" {
|
||
|
name = "network1-%s"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_address" "vpn_static_ip" {
|
||
|
name = "vpn-static-ip-%s"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_forwarding_rule" "fr_esp" {
|
||
|
name = "fr-esp-%s"
|
||
|
ip_protocol = "ESP"
|
||
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
||
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_forwarding_rule" "fr_udp500" {
|
||
|
name = "fr-udp500-%s"
|
||
|
ip_protocol = "UDP"
|
||
|
port_range = "500"
|
||
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
||
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_forwarding_rule" "fr_udp4500" {
|
||
|
name = "fr-udp4500-%s"
|
||
|
ip_protocol = "UDP"
|
||
|
port_range = "4500"
|
||
|
ip_address = "${google_compute_address.vpn_static_ip.address}"
|
||
|
target = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_vpn_tunnel" "tunnel1" {
|
||
|
name = "tunnel1-%s"
|
||
|
peer_ip = "15.0.0.120"
|
||
|
shared_secret = "a secret message"
|
||
|
|
||
|
target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
|
||
|
|
||
|
depends_on = [
|
||
|
"google_compute_forwarding_rule.fr_esp",
|
||
|
"google_compute_forwarding_rule.fr_udp500",
|
||
|
"google_compute_forwarding_rule.fr_udp4500",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
resource "google_compute_route" "route1" {
|
||
|
name = "route1-%s"
|
||
|
network = "${google_compute_network.network1.name}"
|
||
|
dest_range = "15.0.0.0/24"
|
||
|
priority = 1000
|
||
|
|
||
|
next_hop_vpn_tunnel = "${google_compute_vpn_tunnel.tunnel1.self_link}"
|
||
|
}
|
||
|
`, val, val, val, val, val, val, val, val,
|
||
|
)
|
||
|
}
|