This is my current setup for terraform (running on WSL2 ubunutu-18)
Install software
I currently use the following software to manage and interact with terraform:
- tfenv
- tfsec
- driftctl
brew
You can install all the above software via brew
brew install tfenv tfsec driftctl
tfenv
Terraform releases are quick and keeping all our environments on the same version isn’t possible. tfenv resolves that by letting us have multiple versions installed and easy to manage.
tfsec
Gives you a guize
tfenv configuration
We currently have code in 12/13 and 14. We upgrade any terraform that is edited or when we have time in a sprint to refactor. With that I get the latest terraform 14 and 13.
tfenv install latest:^0.14
tfenv install latest:^0.13
tfenv use latest
tfenv basic syntax
- List all versions of
terraformavailable:tfenv list-remote - List installed versions of
terraformtf list(This also shows the current version in use) - Define
terraformversion to usetfenv use latestortfenv use 0.13.6
tfenv support
If you run tfenv list and get the below error. This is because you have not set which version of terraform to use. once defined error goes away ie: tfenv use latest
$ tfenv list
cat: /home/linuxbrew/.linuxbrew/Cellar/tfenv/2.0.0/version: No such file or directory
Version could not be resolved (set by /home/linuxbrew/.linuxbrew/Cellar/tfenv/2.0.0/version or tfenv use <version>)