@@ -333,16 +333,16 @@ func composedKubernetesAsScalingConfigPara() map[string]*schema.Schema {
333333 "security_group_ids" : {
334334 Type : schema .TypeSet ,
335335 Optional : true ,
336- Computed :true ,
336+ Computed : true ,
337337 Elem : & schema.Schema {Type : schema .TypeString },
338338 ConflictsWith : []string {"auto_scaling_config.0.orderly_security_group_ids" },
339- Deprecated : "This field of order cannot be guaranteed. Use `orderly_security_group_ids` instead." ,
339+ Deprecated : "The order of elements in this field cannot be guaranteed. Use `orderly_security_group_ids` instead." ,
340340 Description : "Security groups to which a CVM instance belongs." ,
341341 },
342342 "orderly_security_group_ids" : {
343343 Type : schema .TypeList ,
344344 Optional : true ,
345- Computed :true ,
345+ Computed : true ,
346346 Elem : & schema.Schema {Type : schema .TypeString },
347347 ConflictsWith : []string {"auto_scaling_config.0.security_group_ids" },
348348 Description : "An ordered security groups to which a CVM instance belongs." ,
@@ -775,11 +775,15 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
775775 }
776776
777777 if v , ok := dMap ["security_group_ids" ]; ok {
778- request .SecurityGroupIds = helper .InterfacesStringsPoint (v .(* schema.Set ).List ())
778+ if list := v .(* schema.Set ).List (); len (list ) > 0 {
779+ request .SecurityGroupIds = helper .InterfacesStringsPoint (list )
780+ }
779781 }
780782
781783 if v , ok := dMap ["orderly_security_group_ids" ]; ok {
782- request .SecurityGroupIds = helper .InterfacesStringsPoint (v .([]interface {}))
784+ if list := v .([]interface {}); len (list ) > 0 {
785+ request .SecurityGroupIds = helper .InterfacesStringsPoint (list )
786+ }
783787 }
784788
785789 request .EnhancedService = & as.EnhancedService {}
@@ -925,12 +929,20 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
925929 request .InternetAccessible .PublicIpAssigned = & publicIpAssigned
926930 }
927931
928- if v , ok := dMap ["security_group_ids" ]; ok {
929- request .SecurityGroupIds = helper .InterfacesStringsPoint (v .(* schema.Set ).List ())
932+ if d .HasChange ("auto_scaling_config.0.security_group_ids" ) {
933+ if v , ok := dMap ["security_group_ids" ]; ok {
934+ if list := v .(* schema.Set ).List (); len (list ) > 0 {
935+ request .SecurityGroupIds = helper .InterfacesStringsPoint (list )
936+ }
937+ }
930938 }
931939
932- if v , ok := dMap ["orderly_security_group_ids" ]; ok {
933- request .SecurityGroupIds = helper .InterfacesStringsPoint (v .([]interface {}))
940+ if d .HasChange ("auto_scaling_config.0.orderly_security_group_ids" ) {
941+ if v , ok := dMap ["orderly_security_group_ids" ]; ok {
942+ if list := v .([]interface {}); len (list ) > 0 {
943+ request .SecurityGroupIds = helper .InterfacesStringsPoint (list )
944+ }
945+ }
934946 }
935947
936948 chargeType , ok := dMap ["instance_charge_type" ].(string )
0 commit comments