diff --git a/CHANGELOG.md b/CHANGELOG.md index 2049544308..be588bffb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/tencentcloud/resource_tc_vpn_connection.go b/tencentcloud/resource_tc_vpn_connection.go index 2d764c197f..7014b98577 100644 --- a/tencentcloud/resource_tc_vpn_connection.go +++ b/tencentcloud/resource_tc_vpn_connection.go @@ -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{ @@ -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.") } @@ -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