tfenv is a version manager for Terraform, It is similar to the ruby version manager(rvmenv).

tfenv can be used in Linux, MacOS, Windows OS

Before upgrading the terraform version, First, install tfenv

brew install tfenv

once tfenv is installed, You can install Terraform with a specific version

Use tfenv for Upgrade the Terraform version to a specific version

  • First list all available versions for a terraform
tfenv list-remote

1.6.4
1.5.7
1.5.6
1.5.5

You can install specific versions using tfenv install

tfenv install 1.5.6

if you want to change to a different version, use the below command

tfenv use  1.5.7

Use brew to Upgrade the Terraform version to a specific version

For MacOS users, You can use the below command to install Terraform

brew install terraform

To upgrade latest version

brew upgrade terraform