tfutils / tfenv

Terraform version manager
MIT License
4.51k stars 454 forks source link

Terraform conflicting with tfenv when both installed via brew #386

Open grv231 opened 1 year ago

grv231 commented 1 year ago

Recently installed latest version of terraform, version v1.4.1 on Mac, using Brew. Then tried installing tfenv using brew, but ran into conflict error w.r.t symlinks removal.

  terraform: because tfenv symlinks terraform binaries

Please `brew unlink terraform` before continuing.

Please add the steps in readme on how to troubleshoot/better way of dealing with this so that it doesn't break existing stuff

reegnz commented 1 year ago

That's as expected, as both provide the same executable. You should uninstall (or at least unlink) terraform, and install tfenv, and set a default version (with tfenv use 1.4.1) I think you should not have both installed at the same time, as tfenv replaces the terraform command, and it manages terraform installation from that point, so managing terraform with homebrew makes little sense when using tfenv.

I think the README should mention this though (eg. that you should uninstall terraform that is managed by your package manager).

reegnz commented 1 year ago

As to why go through all this trouble: because historically terraform sucked when it comes to backward-compatibility, so anyone using it should be pinning the terraform version they are using. The state file also depends on the exact terraform version used, which is why you'd want to ensure everyone is using the exact same terraform version for your project and not upgrade to the latest instantly.