Terraform Commands Explained
Learn the most important Terraform commands: init , fmt , validate , plan , apply , destroy , output , and state .
Basic workflow
terraform init terraform fmt terraform validate terraform plan terraform apply
terraform init
Downloads providers, initializes backend, and prepares the working directory.
terraform init
terraform fmt
Formats Terraform files to standard style.
terraform fmt -recursive
terraform validate
Checks whether configuration syntax and structure are valid.
terraform validate
terraform plan
Shows what Terraform will create, update, or destroy.
terraform plan
terraform apply
Applies the planned infrastructure changes.
terraform apply
terraform destroy
Destroys infrastructure managed by the current configuration and state.
terraform destroy
Useful commands
terraform output terraform state list terraform workspace list terraform providers terraform version
Common mistakes
- Running apply without reviewing plan.
- Running destroy in the wrong environment.
- Not running init after changing backend/provider.
- Skipping fmt and validate in CI/CD.
Related guides
- Terraform Learning Path
- Install Terraform
Join the discussion
0 CommentsAsk questions, add context, or share what worked.
More from Melochip Editorial
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026Related articles
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026
Learn Kubernetes monitoring and logs with kubectl logs, events, metrics-server, top commands, Prometheus, Graf...
5 min read · Sep 17, 2026Stay in the loop. Get new Melochip articles
Receive Melochip article updates when new articles are available. Explicit opt-in only.
No comments yet. Start the discussion.