cmdxray / commands / terraform

What does terraform do?

infrastructure-as-code provisioning tool.

▸ Explain your own terraform command →

terraform examples, explained

$ terraform apply -auto-approve -var-file=prod.tfvars

  • terraforminfrastructure-as-code provisioning tool
  • applycreate or update infrastructure to match the config
  • -auto-approveskip the interactive approval prompt
  • -var-file=prod.tfvarsload input variables from this file

$ terraform plan -out plan.tfplan -no-color

  • terraforminfrastructure-as-code provisioning tool
  • planshow the changes required to reach the desired state
  • -outwrite the generated plan to this file
  • plan.tfplanvalue for -out
  • -no-colordisable colored output

terraform subcommands

init — initialize a working directory and download providersplan — show the changes required to reach the desired stateapply — create or update infrastructure to match the configdestroy — remove all managed infrastructurevalidate — check whether the configuration is syntactically validfmt — rewrite config files to the canonical formatoutput — read an output value from statestate — advanced state managementimport — associate existing infrastructure with a resourceworkspace — manage multiple named states

terraform flags & options

-auto-approveskip the interactive approval prompt
-varset a single input variable (name=value)
-var-fileload input variables from this file
-targetlimit the operation to this resource address
-outwrite the generated plan to this file
-no-colordisable colored output
-jsonproduce machine-readable JSON output
-upgradeupgrade provider/module versions during init

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.