Tech Terms Explained Open in the app →

Terraform

Infrastructure · Intermediate · 5 min read

What is it?

Terraform is a tool that lets you define cloud infrastructure as code, so servers, networks, and databases can be created and changed automatically and repeatably.

Explain like I'm 5

Terraform is like a blueprint for your cloud: you write down exactly what you want built, and it constructs it for you — and rebuilds it the same way every time.

Why was it created?

Clicking through cloud consoles by hand is slow, error-prone, and hard to repeat. Terraform was created to manage infrastructure as version-controlled code.

Where is it used?

  • Provisioning cloud resources
  • Repeatable environments (dev/staging/prod)
  • Multi-cloud setups
  • Version-controlled infrastructure

Why should developers care?

Infrastructure as code is a core DevOps practice, and Terraform is one of the most popular tools, so cloud and platform engineers use it widely.

How does it work?

You describe desired resources in configuration files. Terraform compares that desired state to what currently exists and creates, updates, or destroys resources to match, tracking everything in a state file.

Real-world example

A team defines its servers, database, and network in Terraform files; running it spins up an identical environment, and code review catches infrastructure changes before they apply.

Common use cases

  • Creating cloud infrastructure
  • Reproducible environments
  • Managing change safely via plans
  • Multi-cloud provisioning

Advantages

  • Repeatable, version-controlled infrastructure
  • Preview changes before applying
  • Works across many providers
  • Reduces manual errors

Disadvantages

  • State files must be managed carefully
  • Learning curve
  • Drift if resources are changed outside Terraform

When should you use it?

When you want infrastructure that's reproducible, reviewable, and automated.

When should you avoid it?

For a one-off manual experiment where setting up code isn't worth it.

Alternatives

AWS CloudFormationPulumiOpenTofuManual console setup

Related terms

AWSCI/CDKubernetesAmazon VPC

Interview questions

Beginner

  • What is infrastructure as code?
  • What does Terraform do?

Intermediate

  • What is the Terraform state file?
  • What does 'terraform plan' show?

Senior

  • How do you manage state safely in a team?
  • How do you handle configuration drift?

Common misconceptions

  • "Terraform only works with AWS" — it supports many cloud and service providers via plugins.
  • "Terraform applies changes blindly" — it shows a plan of what will change before you approve.

Fun facts

  • Terraform tracks reality in a 'state file' that maps your config to real resources.
  • Infrastructure as code means your environment lives in version control like any other code.

Timeline

  • 2014 — First released by HashiCorp

Learning resources

Quick summary

Terraform defines infrastructure as code, creating and changing cloud resources automatically, repeatably, and with previewable plans.

Cheat sheet

  • Infrastructure as code
  • Declares desired state
  • Plan before apply
  • State file tracks reality

If you remember only one thing

Terraform turns your cloud infrastructure into reviewable, repeatable code.