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

Add support for legacy parsing of main.tf #32

Closed
hinricht opened this issue Aug 27, 2024 · 6 comments · Fixed by #38
Closed

Add support for legacy parsing of main.tf #32

hinricht opened this issue Aug 27, 2024 · 6 comments · Fixed by #38
Assignees
Labels
enhancement New feature or request

Comments

@hinricht
Copy link
Contributor

Is your feature request related to a problem? Please describe.

We'd like to use the main.tf/main.tofu file to pin the opentofu version, just like the terraform plugin does (i.e. https://github.com/asdf-community/asdf-hashicorp/blob/master/bin/parse-legacy-file).

See also the legacy version files documentaion

Describe the solution you'd like

We'd like the plugin to be able to

  • parse main.tf for an opentofu version contraint
  • parse .opentofu-version for an opentofu version contraint (although not that important to us, but this would make it feature-complete to asdf-hashicorp

Describe alternatives you've considered

  • Pinning the opentofu version in .mise.toml is an option, although this leads to 2 places where the tofu version is pinned (.mise.toml and main.tofu)

Additional context

None

@hinricht hinricht added the enhancement New feature or request label Aug 27, 2024
@hinricht
Copy link
Contributor Author

@virtualroot Would you accept a PR ?

@virtualroot
Copy link
Owner

Hi @hinricht 👋 many thanks for opening this feature request.

I'm happy to accept a PR if you and others are willing to resolve any bugs that may appear after the feature is released.

Currently, I do not use mise or legacy_version_file, and I do not have time to maintain it after the release.

wdyt?

@hinricht
Copy link
Contributor Author

@virtualroot Nice, I'll see when I can work on this, and will create a PR.

@hinricht
Copy link
Contributor Author

Here it is, hope it works!

@hinricht
Copy link
Contributor Author

Btw, I'm using mise and noticed that with this change, mise is able to set the tofu version from a main.tofu. but not from a file with a different name (even when I export the ASDF_OPENTOFU_VERSION_FILE env var to this file name).
I checked with the asdf-terradform plugin and it's the same.

Therefore I created a mise issue to track this error: jdx/mise#2602

Just fyi.

@virtualroot
Copy link
Owner

Thanks for the heads-up!

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

Successfully merging a pull request may close this issue.

2 participants