A simple, configuration free, version manager for terraform.
go install github.com/turmantis/terawatt@latestTerawatt is a simple wrapper around terraform. All args are passed through to terraform.
$ echo 'terraform {required_version = "~> 1.2.3"}' > foo.tf
$ terawatt plan
Downloading: https://releases.hashicorp.com/terraform/1.2.3/terraform_1.2.3_linux_amd64.zip
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.- Check if
.terraform-versionexists. If it does, stop and use that version. - Scan all files ending in
.tfand lookingrequired_versionstatement. If it exists, use that version. - Fetch the available versions of terraform and use the latest stable version.
Terawatt saves state in two separate places. The version list and zip bundles are saved in a
temporary subdirectory called .terawatt. It also stores the different versions of Terraform under
the users home directory in a directory called .terawatt.
rm -rf "$HOME/.terawatt"
rm -rf "/tmp/.terawatt"The only thing remaining is terawatt itself.
rm $(which terawatt)