Skip to main content

Module 1, What is Terraform and Why Does It Exist

The Problem It Solves

Before Infrastructure as Code, deploying infrastructure meant:

  1. Log into AWS Console
  2. Click through 12 screens to create a VPC
  3. Click through 8 more screens for an RDS instance
  4. Write it down somewhere, or don't
  5. Three months later: "Which settings did we use?"
  6. New region: start clicking again from scratch
  7. Team member changes something in the console: nobody knows

This is called ClickOps. It does not scale. It is not repeatable. It is not reviewable. It is not auditable.

Infrastructure as Code (IaC) solves all of this by treating infrastructure the same way developers treat application code, write it, version it, review it, test it, deploy it automatically.

What Terraform Is

Terraform is an IaC tool created by HashiCorp. You write configuration files describing what infrastructure you want. Terraform figures out how to create it, in what order, and what to do when you want to change it.

# You write this
resource "aws_s3_bucket" "my_bucket" {
bucket = "my-company-data"
}

# Terraform does this for you
# aws s3api create-bucket --bucket my-company-data

How Terraform Compares to Other Tools

ToolTypeApproachBest for
TerraformIaCDeclarativeMulti-cloud, any infrastructure
AWS CloudFormationIaCDeclarativeAWS-only
AnsibleConfiguration mgmtProceduralServer configuration
PulumiIaCImperative (real code)Developers who prefer Python/TypeScript
CDKIaCImperativeAWS-only, developer-friendly

Declarative, you say what you want, the tool figures out how.
Imperative, you say exactly how to do it, step by step.

Terraform is declarative. You write "I want an S3 bucket", not "create an S3 bucket if it doesn't exist, else update it."

The Terraform Ecosystem

HashiCorp Terraform (open source)

Terraform CLI, what you install and run locally

Providers, plugins that talk to AWS, Azure, GCP, GitHub, etc.

Terraform Registry, public library of modules and providers

HCP Terraform (formerly Terraform Cloud), team platform (paid)

Knowledge Check

  1. What is the difference between declarative and imperative infrastructure tools?
  2. What problem does Terraform solve that CloudFormation also solves?
  3. What is a provider in the context of Terraform?
  4. A colleague says "I'll just create the RDS instance in the console, it's faster." What are the risks?
  5. Name three situations where Terraform is better than ClickOps.
Exam Mapping
  • HashiCorp Associate Obj 1: Understand Infrastructure as Code concepts
  • HashiCorp Associate Obj 2: Understand the purpose of Terraform vs other IaC tools