-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider deprecating / removing remove_default_node_pool in google_container_cluster #4963
Comments
Hey @nicktrav! This was one of the deprecations (and related to several of the deprecations) that I was considering for In the underlying API, all of the "special" fields for the default node pool are deprecated. They can be specified by creating a node_pool with instead. My most feasible proposal involved keeping resource "google_container_cluster" "primary" {
name = "my-gke-cluster"
location = "us-central1"
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
- initial_node_count = 1
# Because we've deleted the default Compute Engine service account, even the
# temporary node pool needs a service account defined.
- node_config {
- service_account = "terraform@my-project.iam.gserviceaccount.com"
- }
+ node_pool {
+ name = "default-pool"
+ initial_node_count = 1
+ node_config {
+ service_account = "terraform@my-project.iam.gserviceaccount.com"
+ }
+ }
# stop a diff based on the default pool being gone
lifecycle {
- ignore_changes = ["node_config"]
+ ignore_changes = ["node_pool"]
}
}
resource "google_container_node_pool" "primary" {
name = "my-only-node-pool"
location = "us-central1"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
node_config {
service_account = "terraform@my-project.iam.gserviceaccount.com"
}
} This would get around the difficulties in importing clusters, but it's a large refactor for many users. I think the thing that would make a deprecation like this worth it is if we could create pool-less clusters, and remove inline configuration of node pools altogether. Removing that option would considerably simplify the UX in Terraform, and be well worth it in a future major release. I've opened an issue against the underlying GKE API (b/132685471, for my own reference), however it hasn't had any uptake unfortunately. To solve your issue at import time, I'll tag this as a |
+1 to removing the inline config of node pools to support node-pool-less clusters, and faster creation of clusters (avoiding creation/deleting of default node pool). |
Signed-off-by: Modular Magician <magic-modules@google.com>
Adding review label until we determine an appropriate type that can be forwarded |
Community Note
Description
When creating a cluster for the first time, the
initial_node_count
can be set along withremove_default_node_pool
to remove the default node pool (this is mentioned in the official documentation for the resource).In the case that a resource is manually created, say with
gcloud
, and then imported into the state file, subsequent plans will attempt to re-create the cluster. For example:It appears this is due
gcloud
leaving this field unset (the API documentation states that the field isdeprecated on the cluster object).
Given this field is deprecated on the underlying GCP API that Terraform is calling, I'd like to propose the following:
initial_node_count
from re-creating the clusterRelevant code for the first point is here:
https://github.com/terraform-providers/terraform-provider-google/blob/2eb04684ddf7de1b2f860b922168d20727caeba1/google/resource_container_cluster.go#L292-L296
New or Affected Resource(s)
References
b/374161595
The text was updated successfully, but these errors were encountered: