Skip to content

Commit c67f2ed

Browse files
committed
disable create/update for security_group_ids.
1 parent 92496ce commit c67f2ed

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tencentcloud/resource_tc_kubernetes_node_pool.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,8 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
776776

777777
if v, ok := dMap["security_group_ids"]; ok {
778778
if list := v.(*schema.Set).List(); len(list) > 0 {
779-
request.SecurityGroupIds = helper.InterfacesStringsPoint(list)
779+
errRet = fmt.Errorf("The parameter `security_group_ids` is deprecated because the order of elements in this field cannot be guaranteed, therefore adding security groups is no longer supported. Please use `orderly_security_group_ids` instead.")
780+
return result, errRet
780781
}
781782
}
782783

@@ -862,7 +863,7 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
862863
return result, errRet
863864
}
864865

865-
func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId string) *as.ModifyLaunchConfigurationAttributesRequest {
866+
func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId string) (*as.ModifyLaunchConfigurationAttributesRequest, error) {
866867
launchConfigRaw := d.Get("auto_scaling_config").([]interface{})
867868
dMap := launchConfigRaw[0].(map[string]interface{})
868869
request := as.NewModifyLaunchConfigurationAttributesRequest()
@@ -932,7 +933,8 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
932933
if d.HasChange("auto_scaling_config.0.security_group_ids") {
933934
if v, ok := dMap["security_group_ids"]; ok {
934935
if list := v.(*schema.Set).List(); len(list) > 0 {
935-
request.SecurityGroupIds = helper.InterfacesStringsPoint(list)
936+
errRet := fmt.Errorf("The parameter `security_group_ids` is deprecated because the order of elements in this field cannot be guaranteed, therefore changing security groups is no longer supported. Please use `orderly_security_group_ids` instead.")
937+
return nil, errRet
936938
}
937939
}
938940
}
@@ -1017,7 +1019,7 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
10171019

10181020
request.InstanceChargeType = &chargeType
10191021

1020-
return request
1022+
return request, nil
10211023
}
10221024

10231025
func desiredCapacityOutRange(d *schema.ResourceData) bool {
@@ -1416,7 +1418,10 @@ func resourceKubernetesNodePoolUpdate(d *schema.ResourceData, meta interface{})
14161418
}
14171419
launchConfigId := *nodePool.LaunchConfigurationId
14181420
// change as config here
1419-
request := composeAsLaunchConfigModifyRequest(d, launchConfigId)
1421+
request, composeError := composeAsLaunchConfigModifyRequest(d, launchConfigId)
1422+
if composeError != nil {
1423+
return composeError
1424+
}
14201425
_, err = client.UseAsClient().ModifyLaunchConfigurationAttributes(request)
14211426
if err != nil {
14221427
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",

0 commit comments

Comments
 (0)