-
Notifications
You must be signed in to change notification settings - Fork 139
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
Search parent directories for Terraform version #218
Labels
new feature
New feature or request
Comments
@joe-a-t @warrensbox is this as simple as updating the current filepath.Join use at Lines 74 to 78 in 3072cc2
I'm happy to have an attempt at a PR for this if no one else has touched it yet. |
Something along the lines of this, if chDirPath isn't required?
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
At my company, we have a bunch of Terraform repos. Within each of those repos, we have hundreds of different Terraform root modules. Currently, we have a
.terraform-version
at the root of each of those repos and use tfenv to search the parent directories looking for those.terraform-version
files and switch the version automatically.We would like to switch to use tfswitch because it is more performant than tfenv with certain IDEs and Terraform auto-formatting plugins, but it would currently require us to go from specifying the Terraform version in a handful of spots at the root of each repo, to specifying it thousands of times in each of our Terraform root modules.
Describe the solution you'd like
Instead of the current behavior of only looking in the current directory for a file that specifies the Terraform version, we would like for tfswitch to automatically search upwards through the parent directories until it finds a
.terraform-version
(or other) file and switch based on that, or if no match is found, drop into the interactiveSelect Terraform version
prompt.Additional context
The issue is not simply with adjusting the hooks that are provided by https://github.com/warrensbox/terraform-switcher#automation, even explicitly running
tfswitch
does not consider the.terraform-version
file in a parent directory. Whenever this feature is implemented, we should also adjust the hook recommendations, maybe to automatically trigger any time that the current directory has.tf
files?The text was updated successfully, but these errors were encountered: