Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions vultr/resource_vultr_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,12 @@ func resourceVultrKubernetesUpdate(ctx context.Context, d *schema.ResourceData,
oldNodePoolData := oldNodePool.(map[string]interface{})
newNodePoolData := newNodePool.(map[string]interface{})

req := &govultr.NodePoolReqUpdate{
NodeQuantity: newNodePoolData["node_quantity"].(int),
req := &govultr.NodePoolReqUpdate{}

// Only send node_quantity when auto_scaler is disabled
// When auto_scaler is enabled, the cluster autoscaler manages node count
if !newNodePoolData["auto_scaler"].(bool) {
req.NodeQuantity = newNodePoolData["node_quantity"].(int)
}

if newNodePoolData["auto_scaler"] != oldNodePoolData["auto_scaler"] {
Expand Down
9 changes: 7 additions & 2 deletions vultr/resource_vultr_kubernetes_nodepools.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,13 @@ func resourceVultrKubernetesNodePoolsUpdate(ctx context.Context, d *schema.Resou
clusterID := d.Get("cluster_id").(string)

req := &govultr.NodePoolReqUpdate{
NodeQuantity: d.Get("node_quantity").(int),
Tag: govultr.StringToStringPtr(d.Get("tag").(string)),
Tag: govultr.StringToStringPtr(d.Get("tag").(string)),
}

// Only send node_quantity when auto_scaler is disabled
// When auto_scaler is enabled, the cluster autoscaler manages node count
if !d.Get("auto_scaler").(bool) {
req.NodeQuantity = d.Get("node_quantity").(int)
}

if d.HasChange("auto_scaler") {
Expand Down
7 changes: 7 additions & 0 deletions vultr/vke.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ func resourceVultrKubernetesNodePoolsV0(isNodePool bool) *schema.Resource {
Type: schema.TypeInt,
ValidateFunc: validation.IntAtLeast(1),
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// When auto_scaler is enabled, node count is managed by cluster autoscaler
if autoScaler, ok := d.GetOk("auto_scaler"); ok && autoScaler.(bool) {
return true
}
return false
},
},
"auto_scaler": {
Type: schema.TypeBool,
Expand Down
Loading