diff --git a/scaleway/resource_k8s_cluster_beta.go b/scaleway/resource_k8s_cluster_beta.go index ccfc7f8d4..668e7a46d 100644 --- a/scaleway/resource_k8s_cluster_beta.go +++ b/scaleway/resource_k8s_cluster_beta.go @@ -484,10 +484,6 @@ func resourceScalewayK8SClusterBetaDefaultPoolUpdate(d *schema.ResourceData, m i PoolID: defaultPoolID, } - if autoscaling, ok := d.GetOk("default_pool.0.autoscaling"); ok { - updateRequest.Autoscaling = scw.BoolPtr(autoscaling.(bool)) - } - if autohealing, ok := d.GetOk("default_pool.0.autohealing"); ok { updateRequest.Autohealing = scw.BoolPtr(autohealing.(bool)) } @@ -500,8 +496,14 @@ func resourceScalewayK8SClusterBetaDefaultPoolUpdate(d *schema.ResourceData, m i updateRequest.MaxSize = scw.Uint32Ptr(uint32(maxSize.(int))) } - if size, ok := d.GetOk("default_pool.0.size"); ok { - updateRequest.Size = scw.Uint32Ptr(uint32(size.(int))) + if autoscaling, ok := d.GetOk("default_pool.0.autoscaling"); ok { + updateRequest.Autoscaling = scw.BoolPtr(autoscaling.(bool)) + } + + if d.Get("default_pool.0.autoscaling").(bool) == false { + if size, ok := d.GetOk("default_pool.0.size"); ok { + updateRequest.Size = scw.Uint32Ptr(uint32(size.(int))) + } } _, err := k8sAPI.UpdatePool(updateRequest) diff --git a/scaleway/resource_k8s_pool_beta.go b/scaleway/resource_k8s_pool_beta.go index e3a585db0..a480bb683 100644 --- a/scaleway/resource_k8s_pool_beta.go +++ b/scaleway/resource_k8s_pool_beta.go @@ -217,7 +217,7 @@ func resourceScalewayK8SPoolBetaUpdate(d *schema.ResourceData, m interface{}) er updateRequest.MaxSize = scw.Uint32Ptr(uint32(d.Get("max_size").(int))) } - if d.HasChange("size") { + if d.Get("autoscaling").(bool) == false && d.HasChange("size") { updateRequest.Size = scw.Uint32Ptr(uint32(d.Get("size").(int))) }