Build cloud infrastructure without the console clicking.
Terraform automates infrastructure provisioning. Instead of manually creating servers, storage and networks in a cloud console, you describe what you want — Terraform figures out how to create it.
What is Terraform?
Terraform is an Infrastructure as Code (IaC) tool developed by HashiCorp. You write the desired infrastructure in configuration files instead of creating everything manually.
Write what you want
For example: “I need 1 server and 1 storage bucket.” You describe the desired end state.
Terraform works out the steps
Terraform uses providers to communicate with cloud platforms and determine the actions needed to reach your desired state.
One tool, many clouds
Terraform supports many cloud and infrastructure providers rather than being tied to one particular cloud provider.
Imagine launching a Chennai food-delivery startup
Suppose your team needs a web server for the application and a storage bucket for images, invoices and other files.
Manual console approach
- Open the cloud console.
- Choose the region and create a server.
- Configure networking and security settings.
- Create a storage bucket.
- Repeat the process for staging and production.
- Document what you clicked so another engineer can reproduce it.
Terraform approach
- Write the desired infrastructure as code.
- Run
terraform planto preview changes. - Run
terraform applyto create it. - Commit the code to Git for version control.
- Reuse the same approach for multiple environments.
- Terraform tracks managed resources using its state.
Example: 1 server + 1 bucketDesired state
↓
resource "aws_instance" "app" { instance_type = "t3.micro" } resource "aws_s3_bucket" "files" { bucket = "chennai-food-app-files" }
↓
What is terraform.tfstate?
Terraform keeps track of the real-world resources it manages in a state file, commonly named terraform.tfstate. The state helps Terraform understand what already exists and what needs to change.
Configuration = what you want
Your .tf files describe the desired infrastructure.
State = what Terraform knows
The state records the resources Terraform manages so future plans can calculate differences.
The Terraform workflow
A simple beginner mental model: write → initialize → check → preview → apply.
.tf configuration.$ terraform init
$ terraform validate
$ terraform plan
$ terraform apply
Benefits of Terraform
Time saving
Automate repetitive infrastructure setup instead of manually repeating console steps.
Fewer human errors
Infrastructure is defined consistently in code, reducing mistakes caused by manual configuration.
Version control
Store infrastructure code in Git, review changes and see who changed what.
Repeatable environments
Use the same patterns for development, staging and production with controlled differences.
Multi-provider
Work with many infrastructure providers instead of learning a completely separate provisioning workflow for every platform.
Preview changes
terraform plan gives you a chance to review intended changes before applying them.
Core commands
| Command | Simple meaning | Changes real infrastructure? |
|---|---|---|
terraform init | Prepare the Terraform project and providers | No |
terraform fmt | Format Terraform files consistently | No |
terraform validate | Check whether configuration is valid | No |
terraform plan | Show what Terraform intends to change | No |
terraform apply | Apply the planned infrastructure changes | Yes |
terraform destroy | Remove infrastructure managed by the configuration | Yes — destructive |
Common questions
Is Terraform an AWS-only tool?
No. Terraform is designed to work with many providers. AWS is just one example.
Is Terraform imperative or declarative?
Terraform uses a declarative approach: you describe the desired end state, and Terraform determines the actions needed to reach it.
Why use Git with Terraform?
Because infrastructure becomes code. Git can provide history, reviews, collaboration and controlled rollbacks of configuration changes.
Does terraform plan create the server?
No. Plan is a preview. The infrastructure-changing command in this basic workflow is terraform apply.