Skip to content

fix(vpc): [123456789] tencentcloud_vpn_connection update e2e #3342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3342.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_vpn_connection: update e2e
```
14 changes: 5 additions & 9 deletions tencentcloud/services/vpn/resource_tc_vpn_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
)

// go test -i; go test -test.run TestAccTencentCloudVpnConnectionResource_basic -v
func TestAccTencentCloudVpnConnectionResource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { tcacctest.AccPreCheck(t) },
Expand Down Expand Up @@ -50,9 +51,6 @@ func TestAccTencentCloudVpnConnectionResource_basic(t *testing.T) {
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "dpd_enable", "1"),
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "dpd_timeout", "30"),
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "dpd_action", "clear"),
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "enable_health_check", "true"),
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "health_check_local_ip", "192.168.0.2"),
resource.TestCheckResourceAttr("tencentcloud_vpn_connection.connection", "health_check_remote_ip", "3.3.3.2"),
),
},
{
Expand Down Expand Up @@ -262,6 +260,7 @@ resource "tencentcloud_vpn_gateway" "vpn" {
test = "test"
}
}

resource "tencentcloud_vpn_connection" "connection" {
name = "vpn_connection_test"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
Expand All @@ -282,19 +281,16 @@ resource "tencentcloud_vpn_connection" "connection" {
ipsec_sa_lifetime_seconds = 3600
ipsec_pfs_dh_group = "DH-GROUP1"
ipsec_sa_lifetime_traffic = 2560
dpd_enable = 1
dpd_timeout = "30"
dpd_action = "clear"
dpd_enable = 1
dpd_timeout = "30"
dpd_action = "clear"
security_group_policy {
local_cidr_block = "172.16.0.0/16"
remote_cidr_block = ["3.3.3.0/32", ]
}
tags = {
test = "test"
}
enable_health_check = true
health_check_local_ip = "192.168.0.2"
health_check_remote_ip = "3.3.3.2"
}
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ func resourceTencentCloudVpnCustomerGatewayRead(d *schema.ResourceData, meta int
if ee.Code == svcvpc.VPCNotFound {
log.Printf("[CRITAL]%s api[%s] success, request body [%s], reason[%s]\n",
logId, request.GetAction(), request.ToJsonString(), e.Error())
return nil
d.SetId("")
return resource.NonRetryableError(fmt.Errorf("Vpc not found."))
} else {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",
logId, request.GetAction(), request.ToJsonString(), e.Error())
Expand Down
Loading