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

Transparently support .terraform-version #32

Open
skyzyx opened this issue Jan 5, 2024 · 2 comments
Open

Transparently support .terraform-version #32

skyzyx opened this issue Jan 5, 2024 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@skyzyx
Copy link

skyzyx commented Jan 5, 2024

Perform the same actions when a .terraform-version file is found, as when an .opentofu-version file is found.

@kvendingoldo
Copy link
Contributor

@skyzyx do you think that it's a good idea? Now we're working on a wrapper that build tfenv and tofuenv together and from my point of view .terraform-version and .opentofu-version should be used by different tools

@kvendingoldo kvendingoldo added enhancement New feature or request good first issue Good for newcomers question Further information is requested and removed good first issue Good for newcomers labels Jan 7, 2024
@skyzyx
Copy link
Author

skyzyx commented Jan 7, 2024

For me, the goal of a tool like this is to help me seamlessly work across a variety of projects, from those still on Terraform 0.11 and HCL1 all the way up to the latest releases.

tfenv uses .terraform-version. tfswitch uses a variety of approaches, including .terraform-version for cross-compat with tfenv. I'm not necessarily a fan of these single-version files myself (I prefer to read the range from versions.tf and pick up the latest compatible release), but they're an extremely popular approach. asdf does something similar.

Since the patch releases of Terraform vs OpenTofu don't line-up 1:1, I realize this is a challenge, and I haven't come up with a good idea for handling this yet.

But, IMO, the goal of a tool like this should be to provide as seamless of a transition from the old tools to the new as possible. Asking teams to define two files that (at first glance) do the same thing, with two slightly different names adds friction to the pipeline.

I suppose it's mildly complex from an engineering standpoint, but obvious in terms of developer experience for end-users that "this is the way it should work."


Maybe if they use .opentofu-version literally, you can add things like support for 1.6 and it will automatically pick up the latest release of OpenTofu 1.6.x.

Maybe tfenv doesn't support this (I prefer tfswitch over tfenv), but if tofuenv finds a .terraform-version file containing 1.6.10 (or whatever) for Terraform, but the latest OpenTofu release is 1.6.3, maybe the tool looks for 1.6.10, can't find it, so it then attempts latest 1.6.x, which turns out to be 1.6.3, and installs that instead.

Of course, the tool would communicate with the user that this is happening so that it isn't thought to be a mistake. But I realize I'm making the assumption that tofuenv does a hard-split at 1.6.0 where >= 1.6.0 always installs OpenTofu, and < 1.6.0 always installs Terraform. I'm not sure. The README doesn't say, and I haven't had a chance to dig into the code yet.

If tofuenv also can install Terraform >= 1.6.0, then this problem just got more complex.


You're right — this starts to get complex fast. I think that knowing/communicating clearly (a) how this tool fits into the overall Terraform/OpenTofu ecosystem, and (b) how this tool is intended to be used by people in the ecosystem who support a broad variety of projects would be very helpful.

Once you (yourselves) are crystal-clear on understanding what you are providing, that will enable you to answer these specific two questions better.

As a user, I only know what you write down. If you've only thought it, I have no way of knowing that. :) Based on the README, it's clear that this is a fork of tfenv. But it is not clear how this tool intends to bridge the gap between the two halves of the exact same ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants