How to use multiple terraform versions at one PC

H

Hi,

it often happens that it is required to manage multiple terraform versions at local machine. The question appears how to do it at easy and in convenient way. There are several ways how current problem can be resolved. At that article we will speak about tfenv util. Installation for Libux systems is rather simple:

1. Use git clone operation:

git clone https://github.com/tfutils/tfenv.git ~/.tfenv

2. Add ~/.tfenv/bin to your $PATH:

echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile

3. Create symlink to the executable files:

sudo ln -s ~/.tfenv/bin/* /usr/local/bin

In case any problems, you may refer to official documentation at tfenv github page

After you have tfenv to be install, you may manage terraform versions in the next way. To install any version of terraform use:

tfenv install [version]

To check what terraform versions do you have at your PC use the next command:

tfenv list

To switch between different terrafom versions:

tfenv use [version]

That’s all – easy-peasy 🙂

architecture AWS cluster cyber-security devops devops-basics docker elasticsearch flask geo high availability java machine learning opensearch php programming languages python recommendation systems search systems spring boot symfony