Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 1.41.2 (Unreleased)

BUG FIXES:
* Resource: `tencentcloud_vpn_connection` fix `security_group_policy` update issue when apply repeatedly.

## 1.41.1 (August 27, 2020)

BUG FIXES:
Expand Down
8 changes: 4 additions & 4 deletions tencentcloud/resource_tc_vpn_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
Description: "Pre-shared key of the VPN connection.",
},
"security_group_policy": {
Type: schema.TypeList,
Type: schema.TypeSet,
Required: true,
Description: "Security group policy of the VPN connection.",
Elem: &schema.Resource{
Expand Down Expand Up @@ -320,7 +320,7 @@ func resourceTencentCloudVpnConnectionCreate(d *schema.ResourceData, meta interf

//set up SecurityPolicyDatabases

sgps := d.Get("security_group_policy").([]interface{})
sgps := d.Get("security_group_policy").(*schema.Set).List()
if len(sgps) < 1 {
return fmt.Errorf("Para `security_group_policy` should be set at least one.")
}
Expand Down Expand Up @@ -639,13 +639,13 @@ func resourceTencentCloudVpnConnectionUpdate(d *schema.ResourceData, meta interf

//set up SecurityPolicyDatabases
if d.HasChange("security_group_policy") {
sgps := d.Get("security_group_policy").([]interface{})
sgps := d.Get("security_group_policy").(*schema.Set).List()
if len(sgps) < 1 {
return fmt.Errorf("Para `security_group_policy` should be set at least one.")
}
request.SecurityPolicyDatabases = make([]*vpc.SecurityPolicyDatabase, 0, len(sgps))
for _, v := range sgps {
m := v.(map[string]interface{})
request.SecurityPolicyDatabases = make([]*vpc.SecurityPolicyDatabase, 0, len(sgps))
var sgp vpc.SecurityPolicyDatabase
local := m["local_cidr_block"].(string)
sgp.LocalCidrBlock = &local
Expand Down