Terraform version managers
- Use case: Creating a TF state with v16 will result in a broken Gitlab CI (which uses TF v14 as default).
- Awesome Opentofu: Environment managers
tofuenv
tenv
Tenv is also designed not as wrapper, but as an in-depended binary program for managing OpenTofu as well as Terraform.
Tfswitch
- Website
- OpenTF Support
- Much easier to start with than
tfenv
Install
Remove any global Terraform binary installations
sudo pacman -R terraform
Then install tfswitch
pamac install tfswitch-bin
Usage
Tfswitch honors the terraform.required_version
setting in i.e. versions.tf
,
and switches to this version.
Use i.e. required_version = "~> 1.4.0"
to require TF v1.4.x
tfswitch
tfenv
- GitHub
- Future Improvement/Feature Request: OpenTF/OpenTofu
- Last commit and release 2022: Is tfenv dead?
- Replaced by tofuenv
Install and setup
pamac install tfenv
mkdir -p ~/.tfenv/bin
export TFENV_CONFIG_DIR=~/.tfenv
Setup GPG key for signature verification
echo 'trust-tfenv: yes' > ${TFENV_CONFIG_DIR}/use-gpgv
sudo mkdir /opt/tfenv/share
gpg --search-key 374EC75B485913604A831CC7C820C6D5CD27AB87
gpg --armor --export 374EC75B485913604A831CC7C820C6D5CD27AB87 > /tmp/hashicorp-keys.pgp
sudo mv /tmp/hashicorp-keys.pgp /opt/tfenv/share/hashicorp-keys.pgp
tfenv usage
tfenv install 1.6.0
Issues
- Could not easily set up GPG verification
- Could not easily install versions as unprivileged user (
TFENV_CONFIG_DIR
andTFENV_INSTALL_DIR
are ignored)