Hands-on labs · from your computer to production

Terraform Labs

Hands-on Terraform practice from your laptop to production: build real projects step by step, starting with local providers and no cloud account, then Docker containers, AWS, Google Cloud and Azure, and a production pipeline. Every lab shows what changes when the same work runs a real system.

Start the first lab →

Every lab ends with In production: what changes when the same work runs a real system, and a checklist you can use at work.

Local

Your own computer. No account, no cost.

  1. Your First Terraform Project: Plan, Apply, Destroy

    Build a small Terraform project on your own computer, with no cloud account: pin providers, declare variables, create resources, read outputs, change an input and watch Terraform replace a resource, then destroy everything.

    Beginner30 minFree

  2. Variables, Locals and for_each: One Config per Environment

    Describe every environment in one typed map variable, generate a file per environment with for_each, compute values with for expressions, and see why removing one environment with for_each touches only that one — while count shifts everything after it.

    Beginner40 minFree

  3. Write a Module and Test It with terraform test

    Extract a naming-and-tagging module with validated inputs, call it twice from a root module, and protect the convention with `terraform test`: plan-mode assertions plus a test that bad input is rejected.

    Intermediate45 minFree

Container

Docker or Docker Compose on your computer.

  1. Run a Web Server in Docker with Terraform

    Use the Docker provider to pull a pinned nginx image, create a network and run a container with a port mapping, a health check and a memory limit. Change the page, watch Terraform replace the container, and see how Terraform reacts when someone stops it by hand.

    Beginner35 minFree

AWS

An AWS account. Free tier where possible; always clean up.

  1. AWS: A Web Server in Its Own VPC

    Build a small but properly structured AWS network — VPC, public subnet, internet gateway, route table and security group — and an EC2 web server with encrypted disk, IMDSv2, no SSH port and Session Manager access.

    Intermediate60 minFree tier (t3.micro), otherwise ≈ $0.02 per hour

  2. AWS: Remote State in S3 with Locking

    Bootstrap a hardened S3 bucket for Terraform state (versioning, KMS encryption, public access blocked, TLS only, protected from deletion), then move an existing configuration's local state into it with S3-native locking.

    Intermediate45 minWell under $0.01: a few small state files and requests in S3

Google Cloud

A Google Cloud project with billing. Free tier where possible; always clean up.

  1. Google Cloud: A VM in a Custom VPC with State in GCS

    Create a custom VPC network and subnet, firewall rules that allow HTTP and SSH only through Identity-Aware Proxy, a dedicated service account, and a Shielded e2-micro VM running nginx — with Terraform state in a versioned Cloud Storage bucket.

    Intermediate55 minAlways Free e2-micro; external IP ≈ $0.005 per hour

Azure

An Azure subscription. Free credits where possible; always clean up.

  1. Azure: A Linux VM with cloud-init and State in Blob Storage

    Create a resource group, virtual network, subnet with a network security group, static public IP and a Linux VM (B1s) configured by cloud-init, with SSH keys only, a managed identity, and Terraform state in a storage account accessed with Entra ID instead of account keys.

    Intermediate55 minFree tier for new accounts, otherwise ≈ $0.02 per hour

Production

Production design: environments, CI/CD, security, monitoring, rollback.

  1. Production: Multi-Environment Layout and a CI/CD Pipeline

    Put it all together the way teams run Terraform in production: a tested module, one root per environment with its own account, backend and variables, GitHub OIDC roles instead of stored keys, and a GitHub Actions pipeline that plans every pull request and applies reviewed plans to dev, then to prod after approval.

    Advanced90 minA few cents (S3, SSM, IAM); Actions free on public repos

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake