tfenv installs, switches, and pins Terraform versions per project, inspired by rbenv, with optional checksum and signature verification.
Overview
tfenv downloads Hashicorp Terraform releases, keeps multiple versions side by side, and selects among them using shell integration or a .terraform-version file. Commands cover install, use, uninstall, list, list-remote, and pin for writing the active version to disk.
Resolution rules honor TFENV_TERRAFORM_VERSION, directory version files, and aliases such as latest, latest:, min-required, and latest-allowed that scan Terraform sources for version constraints. Environment variables configure architecture, auto-install behavior, custom download mirrors, and logging verbosity.
Supported platforms include macOS, Linux on x86_64 and arm64, and Windows under git-bash. Homebrew, AUR, and manual git checkout install paths are documented.
Key features
- Install and switch Terraform versions
- Project .terraform-version file support
- latest and regex version selectors
- min-required and latest-allowed scans
- Optional SHA256 and OpenPGP verification
- Custom remote mirror configuration
- Auto-install missing versions
- pin command writes active version
Use cases
- Pinning Terraform per repository
- Testing against multiple provider versions
- CI machines with consistent tf versions
- Corporate mirrors for Terraform binaries