Install and manage multiple versions of Hashicorp terraform.
Copy script to a directory in your $PATH
, i.e. /usr/local/bin
. Set permissions to allow execution:
sudo curl -o /usr/local/bin/chtf https://raw.githubusercontent.com/avolkov-dazn/chtf/master/chtf
chmod 0755 /usr/local/bin/chtf
Test by executing chtf in your favourite terminal emulator. You should see usage example come up:
$ chtf
Usage: chtf <version, i.e. 0.12.2>
The script takes terraform version as an argument. If the version does not exist locally it will download the version specified from Hashicorp release page. The sha256sum
is verified and the binary is unpacked to /usr/local/bin
with a version number appended. A symbolic link is then created.
If the binary already exists, a symbolic link will be changed.
You should see a confirmation of the version installed when the process is finished:
$ chtf 0.12.2
[sudo] password for user:
Terraform v0.12.2 - good to go
Sudo is required to operate on /usr/local/bin/
.