You can use open source tools like tfenv to upgrade terraform to a specific version.
Step 1: Install tfenv where terraform is installed
1 2 3 4 5 |
## Clone the tfenv project in your system git clone https://github.com/tfutils/tfenv.git ~/.tfenv ## Add ~/.tfenv/bin to your $PATH echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile |
Step 2: Upgrade terraform to a specific version
1 2 3 4 5 6 7 8 9 10 11 |
## Get available terraform version tfenv list-remote ## Upgrade terraform to a specific version tfenv install 1.0.0 ## Make the specific version as default tfenv use 1.0.0 ## Confirm terraform version terraform --version |
Note: If you are upgrading terraform version to a system where your terraform code is hosted, you also need to upgrade terraform code as each terraform major version has some syntactical changes in the way terraform configuration files are written. Please refer https://www.terraform.io/upgrade-guides/index.html for additional details.