-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move to using for_each for node pools #257
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delayed response here: some basic feedback and also we'll need to rebase.
autogen/cluster.tf
Outdated
@@ -225,62 +225,63 @@ resource "google_container_node_pool" "pools" { | |||
{% else %} | |||
provider = google | |||
{% endif %} | |||
count = length(var.node_pools) | |||
name = var.node_pools[count.index]["name"] | |||
for_each = var.node_pools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the external interface as list but build the map internally within the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will keep the existing interface via having this in locals:
node_pool_names = [for np in toset(var.node_pools) : np.name]
node_pools = zipmap(local.node_pool_names, tolist(toset(var.node_pools)))
@Dev25 Just checking if you think you'll be able to make the requested changes (and rebase)? |
Yep, hopefully within the next week or 2 @morgante |
Rebased and kept the same external interface @morgante Will be porting over my existing clusters to this rebased version this week which should further test it, PTAL |
@morgante Can you take another look now? CI is passing after the recent master fixes. |
…#257) BREAKING CHANGE: moves node pool state location to allow using for_each on them
Also: * Pinning the terraform-google-kubernetes-engine module to 6.2.0 due to breaking change: terraform-google-modules/terraform-google-kubernetes-engine#257 * Cleaning buckets before removing them (TF fails otherwise) Fixes: http://b/148036307 Change-Id: Icde3335ee8690190ac87c46a9cbde265f263e84c
…#257) BREAKING CHANGE: moves node pool state location to allow using for_each on them
Use for_each instead of count/index for managing node pools. This is going to be a breaking change for users and they will need to manually edit the state to migrate node pools over.
State Migration:
terraform state rm module.<name>.google_container_node_pool.pools
terraform import 'module.<name>.google_container_node_pool.pools["name"]' {region}/{cluster}{name}
terraform import 'module.gke.google_container_node_pool.pools["spot-pool"]' europe-west1/dev-cluster/spot-pool
Fixes #128