Skip to content

Commit b9f6bcc

Browse files
tongyimingmikatong
andauthored
fix import dpd_timeout error (#1597)
* fix import dpd_timeout error * add changelog --------- Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 0bcbb4d commit b9f6bcc

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.changelog/1597.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/tencentcloud_vpn_connection: fix dpd_timeout read error
3+
```

tencentcloud/resource_tc_vpn_connection.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,14 @@ func resourceTencentCloudVpnConnectionRead(d *schema.ResourceData, meta interfac
671671
_ = d.Set("health_check_remote_ip", *connection.HealthCheckRemoteIp)
672672
// dpd
673673
_ = d.Set("dpd_enable", *connection.DpdEnable)
674-
dpdTimeoutInt, err := strconv.Atoi(*connection.DpdTimeout)
675-
if err != nil {
676-
return err
674+
if *connection.DpdTimeout != "" {
675+
dpdTimeoutInt, err := strconv.Atoi(*connection.DpdTimeout)
676+
if err != nil {
677+
return err
678+
}
679+
_ = d.Set("dpd_timeout", dpdTimeoutInt)
677680
}
678-
_ = d.Set("dpd_timeout", dpdTimeoutInt)
681+
679682
_ = d.Set("dpd_action", *connection.DpdAction)
680683

681684
//tags

tencentcloud/resource_tc_vpn_connection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
1212
)
1313

14-
func TestAccTencentCloudVpnConnection_basic(t *testing.T) {
14+
func TestAccTencentCloudVpnConnectionResource_basic(t *testing.T) {
1515
t.Parallel()
1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { testAccPreCheck(t) },

0 commit comments

Comments
 (0)