Terraform Explained: Infrastructure as Code

# terraform# devops# beginners# programming
Terraform Explained: Infrastructure as CodeThe Practical Developer

Introduction Every application needs infrastructure: servers, databases, networks, DNS...

Introduction

Every application needs infrastructure: servers, databases, networks, DNS records. The old way to create them is clicking through cloud consoles — slow, error-prone, and impossible to reproduce exactly. Terraform, from HashiCorp, takes a different approach: you describe the infrastructure you want in configuration files, and Terraform creates it, updates it, and tracks it for you. Infrastructure as code, in the same way your application is code.

Configuration: describe, don't click

A Terraform file declares resources — things you want to exist — in a readable language called HCL:

resource "aws_instance" "web" {
  ami           = "ami-12345678"
  instance_type = "t3.micro"
  tags = {
    Name = "web-server"
  }
}
Enter fullscreen mode Exit fullscreen mode

Run terraform apply, and Terraform creates that server in AWS. Change t3.micro to t3.small and apply again, and Terraform resizes it. Delete the block and apply, and it destroys the server. The file is the truth: anyone can read it and know exactly what infrastructure exists, and it lives in Git alongside your application code, reviewed like any other change.

State and plans: how Terraform stays safe

Terraform keeps a state file recording what it actually created, so it can compare your configuration with reality. Before changing anything, terraform plan shows exactly what will happen — "1 to add, 0 to change, 1 to destroy" — and you approve it before anything runs. That plan step is the safety net: no more wondering whether a console click just deleted the production database, because every change is previewed in plain text first.

Providers: one tool, many clouds

Terraform works through providers — plugins for AWS, Google Cloud, Azure, Cloudflare, GitHub, and hundreds more — so the same workflow manages servers, DNS, repositories, and SaaS settings alike. That consistency is its real selling point: learn one tool, and your infrastructure process looks the same everywhere, instead of a different console dance per provider.

Takeaway

Describe infrastructure in files, preview every change with a plan, and let state track reality. Terraform turns infrastructure from a series of clicks into reviewable, repeatable code — and for teams, that repeatability is worth more than any single feature.

Originally published at https://practicaldevblog.blogspot.com/2026/10/terraform-explained-infrastructure-as.html