Use when working with Terraform or OpenTofu — plan, apply, state, modules, terragrunt, or any IaC-related task
To get company-specific Terraform settings:
~/Library/hat/state.json to get active_company~/Library/hat/companies/<active_company>/config.yamlcloud.terraform section — reads vars for TF_VAR_* env varsTF_VAR_* env vars should already be set by hat on.
tofu init -backend=false # safe local init (no remote state)
tofu init # full init with backend
tofu fmt # format (required before commit)
tofu validate # validate config
tflint # lint
tofu plan -out=/tmp/plan.tfplan # plan to file
tofu apply /tmp/plan.tfplan # apply (only when instructed)
tofu state list # list resources
tofu state show <resource> # inspect resource
tofu state mv <old> <new> # rename (only when instructed)
tofu state rm <resource> # remove (only when instructed)
tofu import <resource> <id> # import (only when instructed)
terragrunt init
terragrunt plan
terragrunt apply # only when instructed
terragrunt run-all plan # plan all modules
terragrunt run-all apply # only when instructed
terragrunt output
terragrunt state list
tofu output # show outputs
tofu providers # list providers
tofu graph | dot -Tpng > graph.png # dependency graph
tofu fmttofu validatetflinttofu plan -out=/tmp/plan.tfplan.tf filestofu import <resource> <cloud-id>tofu plan — should show no changes if import matches configtofu plan to see what drifted.tf files, plan again to verify no changestofu apply /tmp/plan.tfplantofu state mv <old> <new>Safety: Never run tofu apply, tofu destroy, tofu state rm, or tofu import without explicit user instruction.