Terraform Cheat Sheet
Every Terraform command in the library, on one page. Search, filter by category, or jump to a full command reference for detailed examples.
| Command | Syntax | Description | |
|---|---|---|---|
| terraform init | terraform init | Initializes a working directory — downloads providers and modules, and sets up the backend. | |
| terraform plan | terraform plan [-out=<file>] | Shows what changes Terraform would make without actually applying them. | |
| terraform apply | terraform apply [<plan-file>] | Applies the changes required to reach the desired state described in your configuration. | |
| terraform destroy | terraform destroy | Destroys all resources managed by the current Terraform configuration. | |
| terraform fmt | terraform fmt [-recursive] | Rewrites configuration files to a canonical format and style. | |
| terraform validate | terraform validate | Checks whether a configuration is syntactically valid and internally consistent. | |
| terraform state list | terraform state list | Lists every resource currently tracked in the state file. | |
| terraform state show | terraform state show <resource> | Shows the current state attributes of a single resource. | |
| terraform import | terraform import <resource-address> <id> | Brings an existing, manually-created resource under Terraform management by adding it to the state. | |
| terraform output | terraform output [<name>] | Prints the values of output variables defined in the configuration. |