Managing terraform versions

With the large number of individuals and teams using terraform, it can be difficult to work with the many versions of terraform in a large company, or with multiple clients.

There are two methods I use to manage this:
1. Using docker
2. Using tfenv

The benefit to using docker is that you don’t have to install anything but docker. The problem with this is that it can be difficult to map AWS credential profiles. Here is a sample using the terragrunt image:

docker run -ti --rm -v $HOME/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/apps alpine/terragrunt:0.12.29 init

The benefit to using tfenv is that your AWS credential profiles work well, as they are. The down side is that you may have to install a new version or update versions to match another user, team, or project rather than simply running a docker command. tfenv is not the most friendly utility, but with some practice, it gets the job done.

brew install tfenv
brew unlink terraform
brew install tfenv
tfenv install # installs 0.14.5 at this time
tfenv install 0.12.30
tfenv use 0.14.5
tfenv list


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *