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-approve | skip the interactive approval prompt |
| -var | set a single input variable (name=value) |
| -var-file | load input variables from this file |
| -target | limit the operation to this resource address |
| -out | write the generated plan to this file |
| -no-color | disable colored output |
| -json | produce machine-readable JSON output |
| -upgrade | upgrade provider/module versions during init |
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.