terraform-switcher: Reading automatically from ~/.tfswitch.toml is broken

Hi,

I recently upgraded tfswitch and found out that my binaries stopped going into my custom location /home/dixneuf19/.local/bin/terraform.

I configured this behaviour a long ago with a ~/.tfswitch.toml

bin = "/home/dixneuf19/.local/bin/terraform"

Now with the latest 1.1.1 version, It does not read this file at all and save the binary into the default folder.

> tfswitch --log-level=DEBUG
14:46:26.050 INFO [versiontf.go:34,GetVersionFromVersionsTF] Reading version from Terraform module at "."  
14:46:26.052 DEBUG [list_versions.go:19,getTFList] Get list of terraform versions  
14:46:26.144 INFO [semver.go:14,GetSemver] Reading required version from constraint: "1.3.7"  
14:46:26.146 INFO [semver.go:42,SemVerParser] Matched version: "1.3.7"  
14:46:26.146 INFO [install.go:257,installableBinLocation] Installing terraform at "/home/dixneuf19/bin"  
14:46:26.146 INFO [install.go:307,InstallVersion] Switched terraform to version "1.3.7" 

I could simply add this path to PATH but I don’t think this breaking change is wanted.

It seems to be linked to this PR https://github.com/warrensbox/terraform-switcher/pull/356/files#diff-70bb7ecbe02c1c0fb2f1ba6c3626d57287498e82043aca43fa54cb8649c12392 from @MatrixCrawler which modified quite a lot of things.

Now the code which check for the ~/.tfswitch.toml needs the -c arg to be executed, which is not the wanted behaviour.

Is this a know and undocumented regression, or a bug ?

Anyway for now I will add the ~/bin folder to my path as a workaround.

Anyway thanks for your work on this still very useful tool !

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 17 (5 by maintainers)

Most upvoted comments

No rush, thanks so much! I just downgraded and works fine. Thanks for your work on this project!

Once we get #429 merged and get new release cut, this will be hopefully fixed. Apologies for the inconveniences and that it is taking longer than we anticipated and expected.

As a temp solution you may want to downgrade to previous version of tfswitch that doesn’t not have this bug. Please refer to https://tfswitch.warrensbox.com/Installation/ for instructions on manually “switching” tfswitch version.

I’d be happy to take a look into this, but just need confirmation of expected behavoir - is the order of preseidence:

@MatrixCrawler I assume you’re currently working on this (based on assignee)? If not, happy to help out 😃

@MatrixCrawler do you need help with this? @MatthewJohn or I can help out as well

I’d be happy to take a look into this, but just need confirmation of expected behavoir - is the order of preseidence:

@MatrixCrawler I assume you’re currently working on this (based on assignee)? If not, happy to help out 😃

@yermulnik was working on re-documenting the precedence.