-
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
given key is not an element when using latest private-cluter #419
Comments
Thanks for the report. It looks like the error is on this line. Could you try this fix (and regenerate the modules)? - cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint
+ cluster_endpoint = (var.enable_private_nodes && length(google_container_cluster.primary.private_cluster_config) > 0) ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint |
@morgante it works! Both plan and apply worked as expected. |
As google_container_cluster.primary.private_cluster_config may be empty, we check its length before trying to access it. When creating a new private cluster, a "Invalid index" error was showing up during the planning. By checking for variable length before trying to access it the plan (and apply) works as expected. Issue: [terraform-google-modules#419] Co-authored-by: Morgante Pell <[email protected]>
I'd like to understand in what case I was expecting that block to be set when |
Truth be told, I'm not quite sure how/when it ends up being empty either. I'm guessing it has something to do with changing the value of In either case, I think it's good to have this failsafe. |
* fix Invalid index error when creating a private cluster As google_container_cluster.primary.private_cluster_config may be empty, we check its length before trying to access it. When creating a new private cluster, a "Invalid index" error was showing up during the planning. By checking for variable length before trying to access it the plan (and apply) works as expected. Issue: [#419] Co-authored-by: Morgante Pell <[email protected]> * perform generation Co-authored-by: Morgante Pell <[email protected]>
…m-google-modules#422) * fix Invalid index error when creating a private cluster As google_container_cluster.primary.private_cluster_config may be empty, we check its length before trying to access it. When creating a new private cluster, a "Invalid index" error was showing up during the planning. By checking for variable length before trying to access it the plan (and apply) works as expected. Issue: [terraform-google-modules#419] Co-authored-by: Morgante Pell <[email protected]> * perform generation Co-authored-by: Morgante Pell <[email protected]>
I'm tring to setup a private cluster, using the
private-cluster
module.Unfortunately an error comes up and I've not been able to find it's root cause.
I'm using this module at version
7.0.0
The error is:
My usage of the module is:
Any hint on how to fix it or where to look for further debug? Thanks!
The text was updated successfully, but these errors were encountered: