DEV107 · Infrastructure as Code with Terraform
About Course
Describe infrastructure in code with Terraform so environments can be created, reviewed, changed and destroyed reliably. You will build reusable modules, manage state and variables, and run plans in a pipeline, all with free providers on your own computer.
Who it is for
Operations staff, developers and IT administrators who provision servers, networks or cloud services and want repeatable, reviewable infrastructure.
Prerequisites
Complete DEV105 (DEV104 recommended) or be comfortable with Docker, Git and the command line.
What you will be able to do
- Explain infrastructure as code and the Terraform workflow of init, plan, apply and destroy.
- Write Terraform configurations with providers, resources, variables, outputs and data sources.
- Organize code into reusable modules and manage state safely, including remote backends and locking.
- Run Terraform in a team workflow with formatting, validation, security scanning and plans on pull requests.
Lessons
- Lesson 1 · Infrastructure as code and the Terraform workflow
- Lesson 2 · Variables, state and modules
- Lesson 3 · Terraform in teams and pipelines
- Lesson 4 · Lab and assignment
Lab: Provision a local web stack with Terraform
You will use Terraform with the Docker provider to create a network, a PostgreSQL container with a volume and two web containers, with values passed as variables. You will refactor the web service into a module, create separate dev and staging configurations, scan the code and add a GitHub Actions workflow that runs fmt, validate and plan on pull requests.
Free tools: Terraform CLI or OpenTofu (free), the Docker provider with Docker Desktop, the random and local providers, VS Code with the HashiCorp Terraform extension, TFLint and Trivy for configuration scanning, GitHub Actions
Assessed assignment
Write Terraform code that provisions the environment for a small business application, such as an online store or a clinic's booking system, using the Docker provider locally (or a cloud provider's free tier if you already have an account). Include at least one reusable module, variables with types, descriptions and validation, outputs, two environments that share the module with different settings, and a state backend configuration with notes on locking. Add a CI workflow that runs terraform fmt, validate, TFLint, a security scan and plan on every pull request. Document the architecture, how to apply and destroy each environment, and one change you demonstrated through a reviewed plan.
| Criterion | Weight | What excellent work looks like |
|---|---|---|
| Configuration quality | 30% | Resources, variables and outputs are clear, typed, validated and free of hard-coded secrets. |
| Modules and environments | 25% | The module is genuinely reusable and the environments differ only through inputs. |
| State and workflow | 25% | The state approach is safe, plans run in CI on pull requests and the demonstrated change is reviewed through a plan. |
| Documentation | 20% | The README explains the architecture, apply and destroy steps and the reviewed change clearly. |
Portfolio piece
A modular, documented Terraform codebase with two environments and a CI workflow that plans every change.
Next step
Continue with DEV108 · Monitoring, Logging and Incident Response · 8 hours · $56.00
Course Content
DEV107 · Infrastructure as Code with Terraform (8 h)
-
Lesson 1 · Infrastructure as code and the Terraform workflow
-
Lesson 2 · Variables, state and modules
-
Lesson 3 · Terraform in teams and pipelines
-
Lesson 4 · Lab and assignment
-
DEV107 Assessment · Infrastructure as Code with Terraform
