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

[tfswitch-parity] Auto-install if a .tf file contains a Terraform required_version block #25

Closed
kvendingoldo opened this issue Jan 24, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@kvendingoldo
Copy link
Collaborator

Describe the solution you'd like
Please replicate this feature from tfswitch. https://tfswitch.warrensbox.com/Quick-Start/#use-versiontf-file

Additional context
It's backport of the original issue from tofuenv: tofuutils/tofuenv#31
cc @skyzyx

@kvendingoldo kvendingoldo added enhancement New feature or request good first issue Good for newcomers labels Jan 24, 2024
@dvaumoron
Copy link
Contributor

The default behaviour (when no .opentofu-version or .terraform-version files are found, depending on which proxy command you use) of current version is latest-allowed which scan .tf and .tf.json files to extract required_version constraints.

@dvaumoron dvaumoron closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2024
@giner
Copy link

giner commented Jan 24, 2025

The default behaviour (when no .opentofu-version or .terraform-version files are found, depending on which proxy command you use) of current version is latest-allowed which scan .tf and .tf.json files to extract required_version constraints.

This works (surprisingly) only if the default version is not defined

@dvaumoron
Copy link
Contributor

Hi @giner ,

starting to scan the whole folder before simpler checks does not seem accurate to me.

the resolution ordrer for reference : https://github.com/tofuutils/tenv#project-binaries

tenv look for a TOFUENV_TOFU_DEFAULT_VERSION environment variable after most files have been tested.

@giner
Copy link

giner commented Jan 26, 2025

starting to scan the whole folder before simpler checks does not seem accurate to me

From implementation perspective this makes sense, however from UX perspective the current behavior is not optimal an not vey obvious. If required_version was considered earlier (with higher priority) we wouldn't need .xxx-version files in most cases.

tenv look for a TOFUENV_TOFU_DEFAULT_VERSION environment variable after most files have been tested.

I believe this should be changed. Here's a proposal https://github.com/orgs/tofuutils/discussions/7#discussioncomment-11941382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants