Join our Discord Server

Terraform Cheatsheet

Terraform is an open-source tool for provisioning, managing, and versioning infrastructure as code. It allows developers to define and manage infrastructure using high-level configuration files written in HashiCorp Configuration Language (HCL).


A Terraform cheatsheet is important for several reasons:


  • Quick Reference: Terraform has a large number of commands and options, and a cheatsheet serves as a quick reference for the most commonly used commands and options.

  • Increased Productivity: Having a Terraform cheatsheet readily available can increase productivity by reducing the time spent searching for information and commands.

  • Consistency: A cheatsheet can help ensure consistency in the use of Terraform, making it easier to maintain and manage infrastructure.

  • Onboarding: A Terraform cheatsheet can be a useful resource for new users, helping them to become familiar with the tool and its capabilities.

  • Best Practices: A Terraform cheatsheet can include best practices and tips for using Terraform, making it a valuable resource for both new and experienced users.

Command Description
terraform init Initialize a Terraform working directory.
terraform plan Generate an execution plan for Terraform.
terraform apply Apply changes to infrastructure based on a Terraform plan.
terraform destroy Destroy Terraform-managed infrastructure.
terraform show Show the details of a Terraform plan or state file.
terraform output Output the values of Terraform variables.
terraform graph Show the dependencies between Terraform resources.
terraform taint Force the recreation of a Terraform resource.
terraform state list List all the Terraform resources of a specific type.
terraform state show Show the details of a specific Terraform resource.
terraform state push Save the current Terraform state to a file.
terraform state pull Load a Terraform state from a file.
terraform state pop Reset the Terraform state to its prior state.
terraform -debug Run a Terraform command in debug mode.
terraform console Run Terraform in an interactive mode.
terraform -dir Run Terraform with a specific configuration directory.
terraform -backend-config Run Terraform with a specific Terraform backend.
terraform -state Run Terraform with a specific Terraform state file.
terraform -var-file Run Terraform with a specific Terraform variable file.
terraform -var Run Terraform with a specific Terraform var value.
terraform workspace select Run Terraform with a specific Terraform workspace.

Join our Discord Server