teriac CLI Managing versions

Managing versions

Install, switch, list, upgrade, remove and prune Terraform, Terragrunt and OpenTofu versions, and run one command with another version.

Every command on this page works for all three tools. Add -p tofu for OpenTofu or -p tg for Terragrunt; Terraform is the default.

Version formats

You write You get
1.9.0 Exactly 1.9.0
1.9.^ The latest 1.9.x patch
1.9 The latest 1.9.x patch (use, upgrade)
latest The latest stable release (install), or the latest installed one (use)
1.8.0-beta1 That pre-release. teriac warns you, and never picks a pre-release for latest

1.10 is read as 1.10, not 1.1.

Install a version

teriac install latest                   # latest stable
teriac install 1.9.0                    # exact version
teriac install 1.9.^                    # latest 1.9.x patch
teriac install 1.8.0-beta1              # explicit pre-release (warns you)
teriac install latest --provider tofu   # OpenTofu
teriac install latest -p tg             # Terragrunt
teriac install 1.9.0 --arch amd64       # override architecture

Alias: teriac i.

The architecture defaults to your machine's. Use --arch amd64 on Apple Silicon to get an Intel build, for example for an old version that has no arm64 release. The architecture of each installed version is kept in the store's arch.json.

Every download is checked against the release's SHA256SUMS before they're extracted. See How it works.

Switch version

teriac use 1.9.0
teriac use 1.9                          # latest installed 1.9.x
teriac use latest                       # latest installed version
teriac use 1.8.0 --provider tofu

No sudo: it copies the binary to ~/.teriac/bin/terraform. To switch to whatever a project needs, and install it if it's missing, use auto-switch.

List versions

teriac list                             # installed versions (default)
teriac ls --remote                      # all available versions from HashiCorp
teriac ls --remote --provider tofu      # all available OpenTofu versions
teriac ls -r -p tg                      # all available Terragrunt versions

The active version is marked with ๐Ÿš€.

Current version

teriac current                          # active version + PATH status
teriac which                            # alias
teriac current --provider tofu
Active terraform version: 1.9.0
Binary: /Users/you/.teriac/bin/terraform
Reported: Terraform v1.9.0
PATH OK โ€” 'terraform' resolves to teriac-managed binary

current runs the binary to show what it reports, and checks that terraform on your PATH is the teriac one, not a copy installed by Homebrew or a system package.

Upgrade

teriac upgrade                          # active 1.6.3 โ†’ latest 1.6.x patch
teriac upgrade 1.9                      # install + use latest 1.9.x
teriac upgrade latest                   # install + use the absolute latest
teriac upgrade --provider tofu

upgrade also moves ~/.teriac/bin back to the front of PATH, ahead of any system-installed Terraform.

Remove

teriac remove 1.7.3
teriac rm 1.7.3 1.6.6                   # remove several
teriac rm 1.8.0 --provider tofu

remove warns you if the version is the active one.

Prune

To free space, prune removes every version except the active one:

teriac prune                            # keep only the active version
teriac prune --keep 2                   # keep the 2 most recent + the active version
teriac prune --provider tofu
teriac prune --yes                      # skip the confirmation prompt

The active version is always kept, whatever --keep says. It asks before deleting anything, unless you pass --yes.

Run one command with another version

exec runs a single command with an installed version, without changing the active one. Handy for cross-version testing and CI. Put Terraform or OpenTofu flags after --.

teriac exec 1.9.0 -- version
teriac exec 1.8.0 -- plan -var="env=prod"
teriac exec 1.7.3 --provider tofu -- validate

Example: test a module against several versions

for v in 1.5.7 1.7.5 1.9.0; do
  teriac install "$v"
  teriac exec "$v" -- init -backend=false -input=false
  teriac exec "$v" -- validate
done