@@ -110,7 +110,7 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
110110 Description : "Pre-shared key of the VPN connection." ,
111111 },
112112 "security_group_policy" : {
113- Type : schema .TypeList ,
113+ Type : schema .TypeSet ,
114114 Required : true ,
115115 Description : "Security group policy of the VPN connection." ,
116116 Elem : & schema.Resource {
@@ -320,7 +320,7 @@ func resourceTencentCloudVpnConnectionCreate(d *schema.ResourceData, meta interf
320320
321321 //set up SecurityPolicyDatabases
322322
323- sgps := d .Get ("security_group_policy" ).([] interface {} )
323+ sgps := d .Get ("security_group_policy" ).(* schema. Set ). List ( )
324324 if len (sgps ) < 1 {
325325 return fmt .Errorf ("Para `security_group_policy` should be set at least one." )
326326 }
@@ -639,13 +639,13 @@ func resourceTencentCloudVpnConnectionUpdate(d *schema.ResourceData, meta interf
639639
640640 //set up SecurityPolicyDatabases
641641 if d .HasChange ("security_group_policy" ) {
642- sgps := d .Get ("security_group_policy" ).([] interface {} )
642+ sgps := d .Get ("security_group_policy" ).(* schema. Set ). List ( )
643643 if len (sgps ) < 1 {
644644 return fmt .Errorf ("Para `security_group_policy` should be set at least one." )
645645 }
646+ request .SecurityPolicyDatabases = make ([]* vpc.SecurityPolicyDatabase , 0 , len (sgps ))
646647 for _ , v := range sgps {
647648 m := v .(map [string ]interface {})
648- request .SecurityPolicyDatabases = make ([]* vpc.SecurityPolicyDatabase , 0 , len (sgps ))
649649 var sgp vpc.SecurityPolicyDatabase
650650 local := m ["local_cidr_block" ].(string )
651651 sgp .LocalCidrBlock = & local
0 commit comments