Switching Terraform Versions Easily

Switching Terraform Versions Easily

Play this article

If you are working on multiple Terraform projects at once, you probably also manage multiple versions of the tool. You may stick to an older version for various reasons, one of the most common is breaking changes in Terraform. A clear example of breaking changes is the switch from HCL 1 to HCL 2 which requires some work to update the stack, so you may stick with an older version for some weeks.

If you are on MacOS or Linux there is a really useful tool written by warrensbox called tfswitch. You can find it on GitHub.

tfswitch allows you to easily switch between Terraform versions, and if you don't have the selected version yet, it will download and install it for you.



You can install tfswitch with homebrew:

brew install warrensbox/tap/tfswitch


You can install tfswitch with curl script:

curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash