Infrastructure as Code • Beginner Friendly

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.

$ terraform plan
# Preview before changing anything
+ aws_instance.web
+ aws_s3_bucket.app_data

Plan: 2 to add, 0 to change, 0 to destroy.

$ terraform apply
✓ Infrastructure created
01 · The simple idea

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.

Declarative means: describe the destination, not every step.

Think of ordering food at a restaurant: you say “one masala dosa and one filter coffee.” You do not need to tell the chef every action to perform. Terraform follows the same idea for infrastructure.

02 · Real-world Indian example

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 plan to preview changes.
  • Run terraform apply to 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
You tell Terraform: “I want one application server and one storage bucket.”
resource "aws_instance" "app" { instance_type = "t3.micro" } resource "aws_s3_bucket" "files" { bucket = "chennai-food-app-files" }
Terraform compares your configuration with its recorded state and the real infrastructure, then proposes the required changes.
03 · The memory

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.

Important for teams

In real teams, state management should be designed carefully, commonly using a remote backend with appropriate access control and locking rather than casually sharing a local state file.

04 · How it works

The Terraform workflow

A simple beginner mental model: write → initialize → check → preview → apply.

1. WriteCreate your .tf configuration.
2. initPrepare the project and providers.
3. validateCheck the configuration.
4. planPreview proposed changes.
5. applyMake the changes for real.
$ terraform init
$ terraform validate
$ terraform plan
$ terraform apply
05 · Why teams use it

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.

06 · Quick reference

Core commands

CommandSimple meaningChanges real infrastructure?
terraform initPrepare the Terraform project and providersNo
terraform fmtFormat Terraform files consistentlyNo
terraform validateCheck whether configuration is validNo
terraform planShow what Terraform intends to changeNo
terraform applyApply the planned infrastructure changesYes
terraform destroyRemove infrastructure managed by the configurationYes — destructive
07 · Beginner FAQ

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.