tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Terraform conflicting with tfenv when both installed via brew

Open grv231 opened this issue 1 year ago • 2 comments

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

grv231 avatar Mar 17 '23 00:03 grv231

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 avatar Mar 20 '23 11:03 reegnz

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.

reegnz avatar Mar 20 '23 11:03 reegnz