Manage and change your terraform version easily

Easily manage and change Terraform Version has never been easier. This simple tool will change your Terraform experience.

Manage and change your terraform version easily

You find yourself working on multiple terraform projects and they all have different terraform versions? Changing your Terraform version is tedious and you'd like an easy way to automate this process ?

You could change your path, uninstall your current Terraform version and install the specific one you need or, you could use an easy tool that will simplify your life. If your set it up correctly you won't even have to thing about your terraform version anymore.

I'll show you how to do that in a few lines. You'll thank me later. This tool has changed my DevOps experience.

Lets look at Tfenv !


Unfortunately Tfenv is currently only supported on the following OS:

  • Mac OS X (64 bits)
  • Linux (64 bits & ARM)

Looking on how to change Terraform version on windows ? You could look at how to install Ubuntu Bash on your Windows 10 computer. There is an easy integration with the Linux Bash now available on windows.

If you own a MacBook or a Linux based Computer then you'll be able to install Tfenv in a few seconds.

Installation on MacOs

On MacOs Tfenv is available via brew

brew install tfenv

Install on a linux based OS

In order to get Tfenv working on your computer you need to locally install it.

First clone Tfenv Repository into your home folder.

git clone ~/.tfenv

Add the Tfenv bin into your path

echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile

If you are having difficulties installing it, you can find more information in its GitHub repository.

How to use it ?

Now that you have Tfenv installed on your computer, let's look at how to use it.

tfenv install

The tfenv install [version] installs a specific Terraform version on your computer.

Here are examples on how to use it

tfenv install ### Latest
tfenv install 0.7.0
tfenv install latest
tfenv install latest:^0.8 ## use regex
tfenv install min-required ## scans terraform files to determine version

tfenv use

The tfenv use [version] changes the Terraform version in your path.

Here are examples on how to use it

tfenv use
tfenv use min-required
tfenv use 0.7.0
tfenv use latest
tfenv use latest:^0.8 

tfenv uninstall

Tired of having dozens of Terraform versions on your computer or you need to free up some space.

Then use the command tfenv uninstall [version] like this

tfenv uninstall 0.7.0
tfenv uninstall latest
tfenv uninstall latest:^0.8 ## matches the first one corresponding

tfenv list

If you'd like to list all the versions of Terraform that you have installed on your computer, then run the following command:

tfenv list
* 0.10.7 (set by /opt/tfenv/version)

Auto selection of Terraform version

Tired of always switching terraform version every time you changed project or even folder ?

Add a .terraform-version file inside your terraform project with the required version.

Tfenv will specifically read this file and automatically change the Terraform version for you.

$ cat .terraform-version

$ terraform --version
Terraform v0.6.16

Your version of Terraform is out of date! The latest version
is 0.7.3. You can update by downloading from

$ echo 0.7.3 > .terraform-version

$ terraform --version
Terraform v0.7.3

$ echo latest:^0.8 > .terraform-version

$ terraform --version
Terraform v0.8.8

With all of this commands you'll be able to manage all of your terraform projects without having to change a single time your Terraform version. Everything can be automated in a few lines of codes with the simple addition of the .terraform-version file. Please let me know if you've found a better tool to manage your Terraform versions in the commentary. I'll be more than happy to update my article.

Happy Terraforming !