4.6.1
This commit is contained in:
@@ -183,16 +183,16 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
}
|
||||
|
||||
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||
syscrlSliceMaps := lbSysctlParams.([]map[string]string)
|
||||
syscrlSliceMaps := lbSysctlParams.([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(syscrlSliceMaps))
|
||||
for _, syscrlMap := range syscrlSliceMaps {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
@@ -534,27 +534,28 @@ func resourceK8sUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
}
|
||||
|
||||
if d.HasChange("lb_sysctl_params") && d.Get("with_lb").(bool) {
|
||||
lbSysctlParams := d.Get("lb_sysctl_params").([]map[string]string)
|
||||
lbSysctlParams := d.Get("lb_sysctl_params").([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(lbSysctlParams))
|
||||
for _, syscrlMap := range lbSysctlParams {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: cluster.LBID,
|
||||
SysctlParams: res,
|
||||
}
|
||||
_, err := c.CloudAPI().LB().UpdateSysctlParams(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
if len(res) > 0 {
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: cluster.LBID,
|
||||
SysctlParams: res,
|
||||
}
|
||||
_, err := c.CloudAPI().LB().UpdateSysctlParams(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,16 +168,16 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
}
|
||||
|
||||
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||
syscrlSliceMaps := lbSysctlParams.([]map[string]string)
|
||||
syscrlSliceMaps := lbSysctlParams.([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(syscrlSliceMaps))
|
||||
for _, syscrlMap := range syscrlSliceMaps {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
@@ -552,27 +552,28 @@ func resourceK8sCPUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
}
|
||||
|
||||
if d.HasChange("lb_sysctl_params") && d.Get("with_lb").(bool) {
|
||||
lbSysctlParams := d.Get("lb_sysctl_params").([]map[string]string)
|
||||
lbSysctlParams := d.Get("lb_sysctl_params").([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(lbSysctlParams))
|
||||
for _, syscrlMap := range lbSysctlParams {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: cluster.LBID,
|
||||
SysctlParams: res,
|
||||
}
|
||||
_, err := c.CloudAPI().LB().UpdateSysctlParams(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
if len(res) > 0 {
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: cluster.LBID,
|
||||
SysctlParams: res,
|
||||
}
|
||||
_, err := c.CloudAPI().LB().UpdateSysctlParams(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user