Skip to content
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

Re-add support for environment variable that is a default version #466

Closed
MatthewJohn opened this issue Jun 13, 2024 · 0 comments · Fixed by #463
Closed

Re-add support for environment variable that is a default version #466

MatthewJohn opened this issue Jun 13, 2024 · 0 comments · Fixed by #463
Assignees
Labels
enhancement Refactor existing code for better performance and quality

Comments

@MatthewJohn
Copy link
Collaborator

We used to set TF_VERSION env variable and used this as the fallback (in fact, this is how my projects Terrareg/Terrarun use it).
Now, however, it's the highest priority (excluding CMD arguments)!
Since, historically, the env variable was really treated as overriding the default-version argument, not the actual version flag.
I guess this was broken in the main parameters refactoring (a couple of releases ago) (https://github.com/warrensbox/terraform-switcher/pull/356/files#diff-2873f79a86c0d8b3335cd7731b0ecf7dd4301eb19a82ef7a1cba7589b5252261L149)

I think the correct answer, is to add a new env variable for TF_DEFAULT_VERSION and maybe TOML config for this, which will override the params.DefaultVersion...
I think we'd need to check params.Version at the end of populateParams and, if empty, set to DefaultVersion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactor existing code for better performance and quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants