fix(infra): validate managed_node_groups is map-shaped#1108
Open
davidspielmann wants to merge 1 commit into
Open
fix(infra): validate managed_node_groups is map-shaped#1108davidspielmann wants to merge 1 commit into
davidspielmann wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
An attempt to fix #1064. My apologies for the delay in following up.
Adds a validation block to the
managed_node_groupsvariable ininfra/terraform/variables.tfso non-map input (e.g. a string or list) fails at plan time with a clear message, instead of surfacing a cryptic error later whenmerge(local.default_node_groups, var.managed_node_groups)is evaluated ineks.tf.Keeps
type = any(matching the upstreamterraform-aws-eksconvention) rather than switching tomap(any).Motivation
type = anyaccepts invalid non-map values and defers the failure to themerge()call, where the error is hard to interpret. This change validates the top-level shape up front.It is purely additive. As far as I know, any configuration that plans successfully today plans identically after this change.
More
website/docsorwebsite/blogsection for this featurepre-commit run -awith this PR. Link for installing pre-commit locallyFor Moderators
Additional Notes
Local validation I performed:
terraform fmt -recursive infra/terraformterraform -chdir=infra/terraform init -backend=falseterraform -chdir=infra/terraform validatevalidatesucceeded.pre-commit run -apasses all hooks exceptterraform_tflint, which exits 127 because tflint isn't installed locally; CI runs it with the binary present. If I should run additional tests, please let me know :-)