mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
provider/google: make local_traffic_selector computed now that we read it back from server
This commit is contained in:
parent
3e2f324b20
commit
4b184853a1
@ -68,6 +68,7 @@ func resourceComputeVpnTunnel() *schema.Resource {
|
|||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
Computed: true,
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
Set: schema.HashString,
|
Set: schema.HashString,
|
||||||
},
|
},
|
||||||
|
@ -32,6 +32,22 @@ func TestAccComputeVpnTunnel_basic(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAccComputeVpnTunnel_defaultTrafficSelectors(t *testing.T) {
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckComputeVpnTunnelDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccComputeVpnTunnelDefaultTrafficSelectors,
|
||||||
|
Check: testAccCheckComputeVpnTunnelExists(
|
||||||
|
"google_compute_vpn_tunnel.foobar"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func testAccCheckComputeVpnTunnelDestroy(s *terraform.State) error {
|
func testAccCheckComputeVpnTunnelDestroy(s *terraform.State) error {
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
project := config.Project
|
project := config.Project
|
||||||
@ -137,3 +153,50 @@ resource "google_compute_vpn_tunnel" "foobar" {
|
|||||||
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||||
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||||
acctest.RandString(10), acctest.RandString(10))
|
acctest.RandString(10), acctest.RandString(10))
|
||||||
|
|
||||||
|
var testAccComputeVpnTunnelDefaultTrafficSelectors = fmt.Sprintf(`
|
||||||
|
resource "google_compute_network" "foobar" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
auto_create_subnetworks = "true"
|
||||||
|
}
|
||||||
|
resource "google_compute_address" "foobar" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
region = "us-central1"
|
||||||
|
}
|
||||||
|
resource "google_compute_vpn_gateway" "foobar" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
network = "${google_compute_network.foobar.self_link}"
|
||||||
|
region = "${google_compute_address.foobar.region}"
|
||||||
|
}
|
||||||
|
resource "google_compute_forwarding_rule" "foobar_esp" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
region = "${google_compute_vpn_gateway.foobar.region}"
|
||||||
|
ip_protocol = "ESP"
|
||||||
|
ip_address = "${google_compute_address.foobar.address}"
|
||||||
|
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||||
|
}
|
||||||
|
resource "google_compute_forwarding_rule" "foobar_udp500" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
region = "${google_compute_forwarding_rule.foobar_esp.region}"
|
||||||
|
ip_protocol = "UDP"
|
||||||
|
port_range = "500-500"
|
||||||
|
ip_address = "${google_compute_address.foobar.address}"
|
||||||
|
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||||
|
}
|
||||||
|
resource "google_compute_forwarding_rule" "foobar_udp4500" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
region = "${google_compute_forwarding_rule.foobar_udp500.region}"
|
||||||
|
ip_protocol = "UDP"
|
||||||
|
port_range = "4500-4500"
|
||||||
|
ip_address = "${google_compute_address.foobar.address}"
|
||||||
|
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||||
|
}
|
||||||
|
resource "google_compute_vpn_tunnel" "foobar" {
|
||||||
|
name = "tunnel-test-%s"
|
||||||
|
region = "${google_compute_forwarding_rule.foobar_udp4500.region}"
|
||||||
|
target_vpn_gateway = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||||
|
shared_secret = "unguessable"
|
||||||
|
peer_ip = "8.8.8.8"
|
||||||
|
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||||
|
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||||
|
acctest.RandString(10))
|
||||||
|
Loading…
Reference in New Issue
Block a user