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 --latest should have an equivalent that will conform to version constraints in tf files #475

Open
itsalix opened this issue Jul 2, 2024 Discussed in #474 · 1 comment
Assignees
Labels
new feature New feature or request

Comments

@itsalix
Copy link

itsalix commented Jul 2, 2024

Discussed in #474

Originally posted by itsalix June 26, 2024
I am in a situation where I am automatically running tfswitch for users based on different scenarios.
They can either define a constraint in their terraform block and have tfswitch download the matching version or do nothing and have tfswitch download the latest version available. The issue is, due to the behaviour of running tfswitch --latest, it acknowledges the version constraint in the files but then ignores it to download the latest existing version, as shown below.
❯ tfswitch --latest 11:42:33.966 INFO Reading version from Terraform module at "." 11:42:34.063 INFO Reading required version from constraint: "~> 1.5.0" 11:42:34.064 INFO Matched version: "1.5.7" 11:42:34.158 INFO Switched terraform to version "1.8.5"

I don't want to read in their terraform configuration BEFORE calling tfswitch because tfswitch already has that functionality built in, however I need to know that information before I run the tfswitch command, as it decides whether I run tfswitch or tfswitch --latest
It would be good if there was a flag to not have the interactive selection when not passing a version and not having a version constraint in your tf code, i.e. a --latest flag that does not ignore the constraints in the code, but instead defaults to the latest if no constraint is found. --latest-within-constraint if that makes sense.

I may be missing something obvious that meets my use case 😅 but from reading through docs and playing around at the CLI, I haven't seen anything yet

@yermulnik yermulnik added the new feature New feature or request label Jul 2, 2024
@yermulnik yermulnik linked a pull request Jul 5, 2024 that will close this issue
@yermulnik
Copy link
Collaborator

Looks like the #301 was to address the same or similar feature request, but got abandoned over the time 🤷🏻 So that PR may need some love to be updated to the latest changes, or maybe another PR should be created.

@MatthewJohn MatthewJohn self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants