-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Error if null
value assigned to cluster_config_mode
, or if cluster_config_mode.enabled = false
#3307
Comments
The logic around enabling Auto Mode is based on the value never being null, so use `nullable = false` in the variable definition so that a null value will be interpreted as nn empty map (the default value). Fixes terraform-aws-modules#3307
The API will return an error if compute_config.enabled is set to false, when every other required option for auto mode is also not provided. ``` │ Error: creating EKS Cluster (test-minimum-inputs-kuneic): operation error EKS: CreateCluster, https response error StatusCode: 400, RequestID: 573c664d-68c6-463c-b117-ba12722ebe96, InvalidParameterException: For EKS Auto Mode, please ensure that all required configs, including computeConfig, kubernetesNetworkConfig, and blockStorage are all either fully enabled or fully disabled. ``` Seems like an odd API choice, but that's how it works. Fixes terraform-aws-modules#3307
|
Yes, I get that. Modern Terraform typically uses
That will error because the As far as I can tell, and I tried a lot of variations in the wrapping module unsuccessfully, the only way to fix it is actually here in the upstream module, so it supports a null value correctly. Then we can simply pass the variable object through without extra conditions.
|
I'd be happy to submit a separate PR that fixes just that one bug. Even better, I'd love to actually add typing to the variable here upstream, that would be amazing, and it would also simplify other logic in this module. Requires less of that |
I went ahead and submitted a PR adding the type info, just in case, #3309 |
Description
There is one logic error around the
cluster_config_mode
, and another error around the API interaction.The logic error is that if a user assigns a
null
value tocluster_config_mode
, then thelength()
function throws an error, here:terraform-aws-eks/main.tf
Line 56 in 1bfc10a
Since the default value is already an empty map, that error is most easily fixed by adding
nullable = false
to the variable definition.The second error, around the API interaction, is that if you only set
cluster_config_mode.enabled = false
, then the cluster will plan fine, but then fail to create with an error reported by the API during the apply:In one sense, I think the API is doing the wrong thing, since we're disabling auto mode and the module already empties all the other mentioned configs when disabling the compute config. But probably the easiest way to resolve the problem is to change the condition on the dynamic block to just be
local.auto_mode_enabled
, instead of testing thelength()
of the input...Note that this was previously reported, but the issue was closed without resolution due to lack of details, #3268. Hopefully I've provided enough to pursue/accept a fix.
I'll have a PR ready shortly to resolve this report...
Versions
Module version [Required]: 20.33.1
Terraform version: 1.10.5
Reproduction Code [Required]
Expected behavior
Expected to be able to pass a
null
value tocluster_compute_config
to get the default value.Expected to be able to disable Auto Mode by setting
cluster_compute_config.enabled = false
.Actual behavior
Both scenarios fail, for reasons detailed above.
The text was updated successfully, but these errors were encountered: