Module 1, What is Terraform and Why Does It Exist
The Problem It Solves
Before Infrastructure as Code, deploying infrastructure meant:
- Log into AWS Console
- Click through 12 screens to create a VPC
- Click through 8 more screens for an RDS instance
- Write it down somewhere, or don't
- Three months later: "Which settings did we use?"
- New region: start clicking again from scratch
- 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
| Tool | Type | Approach | Best for |
|---|---|---|---|
| Terraform | IaC | Declarative | Multi-cloud, any infrastructure |
| AWS CloudFormation | IaC | Declarative | AWS-only |
| Ansible | Configuration mgmt | Procedural | Server configuration |
| Pulumi | IaC | Imperative (real code) | Developers who prefer Python/TypeScript |
| CDK | IaC | Imperative | AWS-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
- What is the difference between declarative and imperative infrastructure tools?
- What problem does Terraform solve that CloudFormation also solves?
- What is a provider in the context of Terraform?
- A colleague says "I'll just create the RDS instance in the console, it's faster." What are the risks?
- Name three situations where Terraform is better than ClickOps.
- HashiCorp Associate Obj 1: Understand Infrastructure as Code concepts
- HashiCorp Associate Obj 2: Understand the purpose of Terraform vs other IaC tools