-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(terraform): Handle explicitly-specified tfvars explicitly #7107
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
Conversation
omriyoffe-panw
left a comment
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.
Hey @thentenaar,
First of all thank you for your contribution!
I left a few minor comments, however along with them I am not sure I understand your use of the "explicit" variable. If I understand correctly the goal is to allow for .tfvars file in sub-directories of the project using the -var-file flag. I saw you implemented a search on the directory for .tfvars files but I don't see why you would need the "explicit" variable and I can see some use cases where it might allow for files other then .tfvars to be passed in the flag causing errors.
Would love if you could add a short explanation for this implementation.
Thanks!
gruebel
left a comment
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.
overall the suggested implementation doesn't reflect the actual Terraform behavior and with the added explicit marker makes it harder to maintain than it actually should be, because it is not a simple override mechanism but rather a hierarchical resolution order.
* Allow for ``--var-file`` arguments outside of the tf dir to be handled correctly. * Use a dict to enforce tfvars precedence, grouping vars by the directory for which they were defined, reducing the number of tfvar nodes added to the graph for a given directory. * Create variable -> tfvars edges based on the directory for which the var was defined. * Have _load_files take a list of str instead of os.DirEntry. * Changed a usage of printf() to logging.debug()
fix(terraform): Handle explicitly-specified vars explicitly * Allow for ``--var-file`` arguments outside of the tf dir to be handled correctly. * Use a dict to enforce tfvars precedence, grouping vars by the directory for which they were defined, reducing the number of tfvar nodes added to the graph for a given directory. * Create variable -> tfvars edges based on the directory for which the var was defined. * Have _load_files take a list of str instead of os.DirEntry. * Changed a usage of printf() to logging.debug()
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
--var-filearguments outside of the tf dir to be handled correctlyFixes #4321
Checklist: