How to Install tfswitch: The Terraform Switcher
![]() |
| tfswitch |

If you are suposed to work on multiple terraform versions, then you may need a switcher to juggle out between these versions. "terraform-switcher" comes to your rescue here.
The tfswitch command line tool lets you switch between different versions of terraform. If you do not have a particular version of terraform installed, tfswitch lets you download the version you desire. The installation is minimal and easy. Once installed, simply select the version you require from the dropdown and start using terraform.
Installation
tfswitch is available for MacOS and Linux based operating systems.
Homebrew
Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here.
brew install warrensbox/tap/tfswitch
Linux
Installation for Linux operation systems.
curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
How to use:Use dropdown menu to select version
- You can switch between different versions of terraform by typing the command
tfswitchon your terminal.- Select the version of terraform you require by using the up and down arrow.
- Hit Enter to select the desired version.
The most recently selected versions are presented at the top of the dropdown.
Supply version on command line
- You can also supply the desired version as an argument on the command line.
- For example,
tfswitch 1.1.0for version 1.1.0 of terraform.- Hit Enter to switch.
See all versions including beta, alpha and release candidates(rc)
- Display all versions including beta, alpha and release candidates(rc).
- For example,
tfswitch -lortfswitch --list-allto see all versions.- Hit Enter to select the desired version.
Use environment variable
You can also set the
TF_VERSIONenvironment variable to your desired terraform version. For example:export TF_VERSION=0.14.4 tfswitch #will automatically switch to terraform version 0.14.4Install latest version only
- Install the latest stable version only.
- Run
tfswitch -uortfswitch --latest.- Hit Enter to install.
tfswitch repository: https://github.com/warrensbox/terraform-switcher

No comments