OpenTofu Cheat Sheet

The open-source fork of Terraform — same plan/apply workflow with an open governance model.

Infrastructure as Code3 sections · 15 commands
⌘K

Migrating from Terraform

5
alias tofu=terraform # symbolic

Drop-in alias for most commands

tofu init -migrate-state

Migrate remote state to the fork

tofu init -upgrade

Refresh providers and modules

tofu providers

Providers in the config

tofu version

Check the fork version

Lifecycle

6
tofu init

Init modules and providers

tofu plan

Preview the changes

tofu apply

Apply the plan

tofu destroy

Remove managed resources

tofu output -json

Machine-readable outputs

tofu console

Interactive expression evaluation

Config & State Files

4
main.tf / variables.tf / outputs.tf

Conventional file layout

*.tfstate / *.tfstate.backup

State and backup files (never commit)

.terraform/

Local provider cache (gitignore)

.terraform.lock.hcl

Provider version checksums