@@ -110,7 +110,7 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
110
110
Description : "Pre-shared key of the VPN connection." ,
111
111
},
112
112
"security_group_policy" : {
113
- Type : schema .TypeList ,
113
+ Type : schema .TypeSet ,
114
114
Required : true ,
115
115
Description : "Security group policy of the VPN connection." ,
116
116
Elem : & schema.Resource {
@@ -320,7 +320,7 @@ func resourceTencentCloudVpnConnectionCreate(d *schema.ResourceData, meta interf
320
320
321
321
//set up SecurityPolicyDatabases
322
322
323
- sgps := d .Get ("security_group_policy" ).([] interface {} )
323
+ sgps := d .Get ("security_group_policy" ).(* schema. Set ). List ( )
324
324
if len (sgps ) < 1 {
325
325
return fmt .Errorf ("Para `security_group_policy` should be set at least one." )
326
326
}
@@ -639,13 +639,13 @@ func resourceTencentCloudVpnConnectionUpdate(d *schema.ResourceData, meta interf
639
639
640
640
//set up SecurityPolicyDatabases
641
641
if d .HasChange ("security_group_policy" ) {
642
- sgps := d .Get ("security_group_policy" ).([] interface {} )
642
+ sgps := d .Get ("security_group_policy" ).(* schema. Set ). List ( )
643
643
if len (sgps ) < 1 {
644
644
return fmt .Errorf ("Para `security_group_policy` should be set at least one." )
645
645
}
646
+ request .SecurityPolicyDatabases = make ([]* vpc.SecurityPolicyDatabase , 0 , len (sgps ))
646
647
for _ , v := range sgps {
647
648
m := v .(map [string ]interface {})
648
- request .SecurityPolicyDatabases = make ([]* vpc.SecurityPolicyDatabase , 0 , len (sgps ))
649
649
var sgp vpc.SecurityPolicyDatabase
650
650
local := m ["local_cidr_block" ].(string )
651
651
sgp .LocalCidrBlock = & local
0 commit comments