You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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
ortfswitch --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
The text was updated successfully, but these errors were encountered: