Skip to content
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

container_node_pool docs are outdated #2104

Closed
matti opened this issue Sep 24, 2018 · 4 comments
Closed

container_node_pool docs are outdated #2104

matti opened this issue Sep 24, 2018 · 4 comments

Comments

@matti
Copy link

matti commented Sep 24, 2018

https://www.terraform.io/docs/providers/google/r/container_node_pool.html

Usage with a regional cluster

resource "google_container_cluster" "regional" {
  name   = "marcellus-wallace"
  region = "us-central1"
}

resource "google_container_node_pool" "regional-np" {
  name       = "my-node-pool"
  region     = "us-central1"
  cluster    = "${google_container_cluster.primary.name}"
  node_count = 1
}

^-- that usage won't work Error 400: Cluster.initial_node_count must be greater than zero., badRequest

@wyardley
Copy link

I am also seeing similar issues (w/ zonal clusters)
#285 has some really good explanations and examples that, AFAICT, still haven't made it into the docs.

@hawksight
Copy link

You're right that you get exactly that error, but the issue is not with the google_container_node_pool resource, but rather with the google_container_cluster configuration. The Google API creates the cluster first, but it will not create without a node.

Error 400: Cluster.initial_node_count

You might want to consider the following options if you are trying to create a cluster with only your specified node_pool:

resource "google_container_cluster" "regional" {
  name   = "marcellus-wallace"
  region = "us-central1"
  intital_node_count = "1"
  remove_default_node_pool = "true"
}

resource "google_container_node_pool" "regional-np" {
  name       = "my-node-pool"
  region     = "us-central1"
  cluster    = "${google_container_cluster.regional.name}"
  node_count = 1
  depends_on = ["google_container_cluster.regional"]
}

(Code snippets from own config - untested as seen)

That should create the cluster with the default node_pool and terraform then removes the default node_pool. You get around the issue by providing intital_node_count = "1".

@wyardley points to some good discussions about why creating cluster / node_pools can be very tricky. There's a lot of combinations to cover.

On the cluster docs it does say:

initial_node_count - (Optional) The number of nodes to create in this cluster (not including the Kubernetes master). Must be set if node_pool is not set.

Unsure how to clarify the docs, but hoping that solution gives a way to achieve what I think you were trying to.

@rileykarson
Copy link
Collaborator

Should be fixed when I made a pass at these docs, but let me know if that's not the case. GoogleCloudPlatform/magic-modules#1329

@ghost
Copy link

ghost commented Mar 18, 2019

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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants