Skip to main content
intermediate learning path

Terraform Learning Path

Learn Terraform in order: HCL, resources, state, modules and environments, then build real cloud infrastructure. Free guides, simulators and exercises.

25steps
5stages
~10hours

What you will be able to do

  • Explain what Terraform does and run the init, plan and apply loop
  • Write HCL with variables, loops, outputs and data sources
  • Keep state safe with a remote backend and locking, and move resources without recreating them
  • Split code into modules and separate environments
  • Build a VPC and a server on a real cloud

10 guide chapters, 6 articles, 2 simulators, 2 interview questions, 2 exercises, 1 checklist, 1 challenge, 1 quiz. Every step is free. Tick a step when you finish it, or let the guide, exercise and checklist pages tick it for you.

// your progress

0 / 25 steps

Start the path

Step 1: What Is Terraform? Core Concepts and Workflow

  1. // stage 014 steps · 1 h 1 min

    Infrastructure as code

    What Terraform does, and the workflow you repeat for every change.

    1. Guide chapter14 min

      What Is Terraform? Core Concepts and Workflow

      What Terraform is, how providers work and the core workflow.

    2. Guide chapter22 min

      How to Install Terraform and Run Your First Apply

      Install Terraform and run your first apply.

    3. Simulator20 min

      Terraform Basics Simulator

      Run init, plan and apply in a browser terminal and watch state change.

    4. Interview question5 min

      Infrastructure as Code Patterns

      Explain the common IaC patterns and when each one fits.

  2. // stage 025 steps · 1 h 19 min

    The language

    Read and write HCL with confidence, from a single resource to loops.

    1. Guide chapter15 min

      Terraform Configuration Language (HCL) Basics

      Blocks, arguments, expressions and types.

    2. Guide chapter21 min

      Terraform Resources, Data Sources and Meta-Arguments

      Resources, data sources and meta-arguments such as count and for_each.

    3. Guide chapter15 min

      Terraform Variables and Outputs

      Inputs and outputs that make one configuration reusable.

    4. Article16 min

      Terraform Variables, Loops, and Outputs: The Complete Guide

      Loops and conditionals with worked examples you can copy.

    5. Article12 min

      How to Reference for_each Resources in Terraform: Keys, Indexes and Import

      Reference for_each resources by key, and import ones that already exist.

  3. // stage 035 steps · 1 h 14 min

    State

    The file Terraform trusts more than your cloud, and how to keep it safe.

    1. Guide chapter21 min

      Terraform State Management: Commands, Drift and Locking

      What state is, how drift happens and the state commands.

    2. Simulator15 min

      Terraform State Puzzle

      Solve state puzzles and predict what the next plan will do.

    3. Article14 min

      Terraform State: Remove, Move and Migrate Resources, and Set Up a Remote Backend

      Move and remove resources in state without destroying them.

    4. Guide chapter19 min

      Terraform Remote Backends: S3 Native Locking and Team Workflows

      Remote backends with locking, so a team can share one state.

    5. Interview question5 min

      Terraform State Management

      Answer the state questions almost every Terraform interview asks.

  4. // stage 045 steps · 1 h 24 min

    Modules and environments

    Organize code so dev, staging and production share it without stepping on each other.

    1. Guide chapter13 min

      Terraform Modules: Write, Use and Version Them

      Write, use and version modules.

    2. Article14 min

      Terraform Module Outputs, Inputs and Sources: How Modules Pass Data to Each Other

      How modules pass data to each other through inputs and outputs.

    3. Guide chapter14 min

      Managing Multiple Environments with Terraform

      Keep dev, staging and production apart.

    4. Article13 min

      How to Organize a Terraform Repository: Environments, Modules, Files

      A repository layout that still works when the code grows.

    5. Checklist30 min

      Terraform Repository Structure Checklist

      Check your layout against a review list.

  5. // stage 056 steps · 4 h 57 min

    Real infrastructure

    Build on a real cloud, fix broken code and keep it in sync with reality.

    1. Exercise1 h

      Deploy a DigitalOcean Droplet with Terraform

      Create a server with Terraform from an empty directory.

    2. Exercise2 h

      AWS VPC with Terraform

      Build an AWS VPC with public and private subnets.

    3. Challenge1 h

      Fix the Network Module

      Fix a broken network module. CI grades your pull request.

    4. Guide chapter23 min

      Terraform Best Practices for Production

      The habits that keep Terraform safe in production.

    5. Article19 min

      Terraform Drift Detection, Measured: What a Scheduled Plan and a Cloud Inventory Each Miss

      Catch drift between code and cloud before it surprises you.

    6. Quiz15 min

      Terraform Fundamentals Quiz

      Test what you learned across the whole path.

// next pathObservability and Monitoring