hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.32k stars 1.72k forks source link

Support turning off cluster autoscaler in google_container_node_pool #14114

Open talonx opened 1 year ago

talonx commented 1 year ago

Community Note

Description

The google_container_node_pool resource does not support turning off the cluster autoscaler. It has an autoscaling configuration block which just has options to set the max and min nodes, but not turn it off entirely.

This feature is available in the GKE console, which means it must be part of the GKE API also.

New or Affected Resource(s)

Potential Terraform Configuration

NA

References

b/299601056

rileykarson commented 1 year ago

I think that this might get turned off by setting certain settings- the Console may display it differently than the API representation

edwardmedia commented 1 year ago

enabled is available at its api. https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters.nodePools#NodePool.NodePoolAutoscaling

parupappa commented 8 months ago

@talonx @rileykarson I would like to pick this issue up . I will add the PR.

nemethloci commented 6 months ago

I've just tested this and at least the removal of the whole autoscaler block disables autoscaling:


  dynamic "autoscaling" {
    for_each = lookup(each.value, "autoscaling", true) ? [each.value] : []
    content {
      min_node_count = lookup(autoscaling.value, "min_count", 1)
      # The following number will retermine the maxumum number of nodes per location = zone, which
      # means we'll have 3x this much nodes in the pool distributed ~ evenly between the 3 zones
      # https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#nodepoolautoscaling
      max_node_count = lookup(autoscaling.value, "max_count", 10)
    }
  }