Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade Terraform to a previous version?

Tags:

terraform

I have installed a version (0.12.24) of Terraform which is later than the required version (0.12.17) specified in our configuration. How can I downgrade to that earlier version? My system is Linux Ubuntu 18.04.

like image 663
James Adams Avatar asked May 19 '20 21:05

James Adams


People also ask

Can you downgrade Terraform version?

There are certain scenarios in which it becomes necessary to downgrade the version of the Terraform command line tool used by Terraform Cloud or Terraform Enterprise (TFC/E). In workspaces that have already run on a higher version, you must manually modify the state file to allow for downgrading.

How do I change my Terraform version?

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.

How do I uninstall Terraform?

Run the UninstallerDownload the uninstaller: Run curl https://install.terraform.io/tfe/uninstall > uninstall.sh . Make the script executable: Run chmod +x uninstall.sh . Execute the uninstaller: Run sudo bash uninstall.sh to execute the script.


1 Answers

As long as you are in linux, do the following in the terminal:

rm -r $(which terraform)

Install the previous version:

wget https://releases.hashicorp.com/terraform/1.1.7/terraform_1.1.7_linux_amd64.zip 

unzip terraform_1.1.7_linux_amd64.zip

mv terraform /usr/local/bin/terraform

terraform --version

That's it, my friend.

EDIT: I've assumed people now use v1.1.8 so the previous version is v1.1.7.

like image 152
Luigi Lopez Avatar answered Sep 20 '22 16:09

Luigi Lopez