Use case
I have installed Terraform v0.11.13 via homebrew and as recommended by terraform I want to ugprade to version v0.11.14 before doing the major upgrade to v0.12.0.
The problem
When I run brew upgrade terraform
or download the Mac package from the terraform website it would immediately update my terraform version to v0.12.0 I think.
So how can I upgrade to v0.11.14 instead?
You can switch between different versions of terraform by typing the command tfswitch on your terminal. Select the version of terraform you require by using the up and down arrow. Hit Enter to select the desired version.
Run the Terraform 0.12upgrade command The command given above will start at the directory containing all of your Terraform modules and work through them one by one, running the upgrade command along the way. It will update the Terraform syntax in each module.
We strongly recommend completing an upgrade to the latest Terraform v0. 11 release first.
Especially when playing around with Terraform 0.12 betas, I learned to love tfenv.
After installation (via brew install tfenv
on MacOS), this allows you to easily discover, install and activate any Terraform version:
$ tfenv list-remote 0.12.0 0.12.0-rc1 0.12.0-beta2 0.12.0-beta1 0.12.0 0.11.14 ... $ tfenv install 0.11.14 [INFO] Installing Terraform v0.11.14 [INFO] Downloading release tarball from https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_darwin_amd64.zip ... [INFO] Installation of terraform v0.11.14 successful [INFO] Switching to v0.11.14 [INFO] Switching completed
If you want to switch to a different version:
$ tfenv use 0.12.0 [INFO] Switching to v0.12.0 [INFO] Switching completed
For anyone looking to do the same without using homebrew:
$ wget https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip $ unzip terraform_0.11.14_linux_amd64.zip
$ chmod +x terraform $ sudo mv terraform /usr/local/bin/
$ terraform --version
Source: https://titosoft.github.io/kvm/terraform-and-kvm/#installing-terraform
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With