Terraform Cheatsheet

Source: Dev.to | Jan 29, 2026 (UTC)

Have you ever worked with Terraform?

For those working in DevOps and Cloud Computing, Terraform can be a very important tool for Infrastructure as Code (IaC).
That’s why I created this cheat sheet with the essential Terraform commands every professional should know by heart.

Basic workflow (most important commands):

Check and Apply (Create/Change resources):

terraform init: Initializes your working directory and configures the backend for new and existing projects.
terraform plan: Generates the execution plan, showing which resources will be created or changed in the infrastructure.
terraform apply: Applies the planned changes to build your infrastructure and deploy the resources.

Check and Manage:

terraform validate: Checks the code for errors to ensure your configuration is syntactically correct.
terraform show & terraform state: Display the current Terraform state in a readable format and allow you to inspect, list, and manipulate resources directly in the state file. Essential for understanding the current state of your infrastructure.

Destroy your deployment:
terraform destroy: Removes all resources managed by Terraform. Be careful with this command! 😄

Command explanations:

terraform init – Initializes the project by downloading providers and configuring the backend.

terraform plan – Shows what will be created, changed, or destroyed before applying.

terraform apply – Applies the changes defined in the Terraform code.

terraform show – Displays the current state or plan in a readable format.

terraform destroy – Removes all resources managed by Terraform.

terraform validate – Validates the syntax and structure of Terraform files.

terraform output – Shows the output values defined in the state.

terraform state – Allows you to inspect and manipulate the state file.

terraform fmt – Formats Terraform files according to the official style.

terraform graph – Generates a graph of dependencies between resources.

terraform import – Imports existing resources into the Terraform state.

terraform refresh – Updates the state with what exists in the real environment.

terraform taint – Marks a resource to be recreated on the next apply.

terraform untaint – Removes the recreation mark from a resource.

That’s all, folks!

I hope this cheat sheet helps you remember the commands and better understand the IaC lifecycle with Terraform.

Terraform #DevOps #IaC #InfrastructureAsCode #CloudComputing #AWS #Azure #TechTips #CheatSheet #DeveloperLife #TechCommunity #Automation #SRE

For further actions, you may consider blocking this person and/or reporting abuse

Залишити відповідь

Ваша e-mail адреса не оприлюднюватиметься. Обов’язкові поля позначені *

Читайте також