teriac CLI Command reference

Command reference

Every teriac CLI command, alias and flag on one page.

Usage: teriac <command> [options]

Run teriac or teriac --help for a table of commands, and teriac <command> --help for a command's options.

All commands

Command Alias What it does
Versions
install <ver> i Install a Terraform, Terragrunt or OpenTofu version
use <ver> Switch to an installed version
list ls List installed or available versions
current which Show the active version and PATH status
upgrade [ver] Upgrade to the latest patch in the active (or given) series
remove <ver..> rm Remove versions from the store
prune Remove every version except the active one
exec <ver> Run one command with a version, without switching
Projects
auto-switch as Switch to the version the project needs
pin [ver] Write the active (or given) version to a version file
shell-init <shell> Print the shell hook and completions
Terraform
init Run terraform init
plan Run terraform plan, with optional file-based targets
apply Run terraform apply, with optional file-based targets
destroy Run terraform destroy, with optional file-based targets
fmt Run terraform fmt
validate Run terraform validate
Setup
doctor Check PATH, binaries, store and shell config
plugin-cache [action] Share downloaded providers across projects

Global options

Option
-h, --help Show help
--version Show teriac's version
-p, --provider terraform (default), tofu / opentofu, terragrunt / tg. The Terraform commands take terraform or tofu

install

Install a version. Alias i.

Argument / option Default
<ver> 1.10.2, 1.10.^, latest, or a pre-release like 1.8.0-beta1
-a, --arch your machine's arm64, amd64, …
-p, --provider terraform
teriac install 1.9.^ -p tofu

use

Switch to an installed version.

Argument / option Default
<ver> 1.10.2, 1.10, 1.7.^ or latest (latest installed)
-p, --provider terraform

list

List versions. Alias ls.

Option Default
-l, --local true Installed versions
-r, --remote Every available version
-p, --provider terraform

current

Show the active version, its binary, what it reports, and whether PATH resolves to it. Alias which. Takes -p.

upgrade

Install and switch to the latest patch of the active series, or of the series you give (1.9, latest). Also moves ~/.teriac/bin back to the front of PATH. Takes -p.

remove

Remove one or more versions. Alias rm. Warns when you remove the active version.

Argument / option Default
<ver..> One or more versions
-p, --provider terraform

prune

Remove every version except the active one.

Option Default
-k, --keep 0 Also keep the N most recent versions
-y, --yes false Skip the confirmation prompt
-p, --provider terraform

exec

Run one command with an installed version, without changing the active one. Arguments for the tool go after --.

teriac exec <ver> [-p provider] -- <args...>
teriac exec 1.8.0 -- plan -var="env=prod"

auto-switch

Read the version the project needs, install it if missing, and switch to it. Alias as. See Auto-switch and pinning.

Option Default
-p, --provider terraform
-s, --silent false No output (used by the shell hook)
--hook false Switch every tool the project pins (used by the shell hook)

pin

Write a version file in the current folder: .terraform-version, .opentofu-version or .terragrunt-version.

Argument / option Default
[ver] the active version
-p, --provider terraform

shell-init

Print the shell hook (switch on cd) and tab completions for a shell: bash, zsh, fish, powershell or pwsh. See Switch on cd.

Terraform commands

init, plan, apply, destroy, fmt and validate run the managed binary. Extra flags go after --. See Terraform commands.

Option Commands
-f, --file plan, apply, destroy .tf file(s) to take -targets from. Repeat for more
-p, --provider all terraform (default) or tofu

doctor

Check the store, active binaries, PATH order, PATH conflicts and shell config. Exits with 1 if anything is wrong. See Doctor.

plugin-cache

Share downloaded providers across projects.

Argument Default
[action] status on, off or status

Environment variables

Variable
TERIAC_HOME Where teriac keeps everything (default ~/.teriac)
TERIAC_HASHICORP_MIRROR Replaces https://releases.hashicorp.com
TERIAC_GITHUB_MIRROR Replaces https://github.com
TERIAC_VERIFY_SIGNATURES false skips the vendor signature check, for mirrors without .sig files.
GITHUB_TOKEN / GH_TOKEN Raises GitHub's API limit for OpenTofu and Terragrunt version lists
NO_COLOR Plain help output without colours

Exit codes

Code
0 Success
1 An error, or doctor found a problem
other exec and the Terraform commands return the tool's own exit code