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.33k stars 1.73k forks source link

min_node_count of 1 results in 0 nodes unless initial_node_count is explicitly set #8270

Closed katebrenner closed 3 years ago

katebrenner commented 3 years ago

Community Note

Affected Resource(s)

Terraform Configuration Files

# config before ( resulted in 0 nodes ) .
resource "google_container_node_pool" "nodes_pools" {
  count              = length(var.regions)
  name               = "${var.machine_type}-${var.regions[count.index]}"
  location           = var.regions[count.index]
  cluster            = google_container_cluster.clusters[count.index].name

  autoscaling {
    min_node_count = 1
    max_node_count = 3
  }

  node_config {
    preemptible     = false
    machine_type    = var.machine_type
    disk_type       = "pd-ssd"
    service_account = google_service_account.gke-cluster.email
  }
}

# after ( resulted in proper amount of nodes ) 

resource "google_container_node_pool" "nodes_pools" {
  count              = length(var.regions)
  name               = "${var.machine_type}-${var.regions[count.index]}"
  location           = var.regions[count.index]
  cluster            = google_container_cluster.clusters[count.index].name
  initial_node_count = 1

  autoscaling {
    min_node_count = 1
    max_node_count = 3
  }

  node_config {
    preemptible     = false
    machine_type    = var.machine_type
    disk_type       = "pd-ssd"
    service_account = google_service_account.gke-cluster.email
  }
}

Expected Behavior

Would have expected 1 node per zone

Actual Behavior

resulted in 0 nodes

edwardmedia commented 3 years ago

@katebrenner below is the comment in the doc for google_container_cluster. Does it make sense?

initial_node_count - (Optional) The number of nodes to create in this cluster's default node pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Must be set if node_pool is not set. If you're using google_container_node_pool objects with no default node pool, you'll need to set this to a value of at least 1, alongside setting remove_default_node_pool to true.

katebrenner commented 3 years ago

@edwardmedia Thank you! Yes that makes sense for google_container_cluster ! However, this information is missing from the container_node_pool doc in which I was referencing. Could it be added there as well for extra clarity?

edwardmedia commented 3 years ago

@katebrenner it could. Please file a separate issue labelled document for triage. Closing this issue then. Thank you

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!