Terraform

Terraform Practice

Master Terraform from your first configuration to advanced infrastructure management. Learn providers, resources, state, variables, modules, environments, secrets, dependencies, lifecycle management, and infrastructure changes through hands-on problems. Every challenge is verified against a real local AWS environment, giving you practical experience with how Terraform actually provisions, manages, and changes infrastructure.

Terraform 1.15Terraform 1.15Linux CLILinux CLI
Read the Terraform overview
Module 1

HCL Fundamentals & Providers

Write your first configuration and drive the init, plan, apply, destroy lifecycle with pinned providers.

4
About this challenge

Write a minimal configuration with pinned Terraform and AWS provider versions pointed at the local endpoint, and drive it through init, plan, apply, and destroy with a storage bucket as the managed resource - proving the plan previews before creation, a second plan is clean, and destroy leaves an empty state.

About this challenge

Constrain the AWS provider with a pessimistic version constraint and create the dependency lock file, then demonstrate that re-initialization respects the locked version and hashes, a constraint excluding the locked version is refused, and an explicit upgrade moves the selection only within the constraint.

About this challenge

Modify an existing configuration so one plan contains a create, an in-place update, and a replacement; read the plan to classify each action, apply the approved saved plan exactly, and prove that a stale saved plan is refused after the state moves on.

About this challenge

From an empty directory, build a pinned and locked configuration, then drive a create, an in-place update, and a replacement entirely through saved plans - proving idempotence between steps with no-change plans, capturing a stale-plan refusal after the state moves, and finishing with a complete destroy that empties state and endpoint.

Module 2

Variables, Outputs & Locals

Parameterize configurations with typed, validated inputs and expose what tooling needs.

4
About this challenge

Extract hardcoded values into typed variables - string, number, bool, list, and object - with defaults and validation rules that reject bad values with defined messages, proving that mistyped and out-of-range inputs fail at plan time while defaults and supplied values flow into the resource verbatim.

About this challenge

Set one variable through defaults, an environment variable, an auto-loaded tfvars file, an explicitly passed tfvars file, and a command-line flag, capturing a plan at each rung to prove the precedence order - with the winning command-line value observable in the applied resource.

About this challenge

Centralize a derived naming expression in a local consumed by multiple resources, and expose described outputs including a sensitive one - reading them back as a plain listing with the sensitive value redacted, a single raw value, and machine-readable JSON where the sensitive value is present.

About this challenge

Build a fully parameterized configuration: typed and validated variables across primitive and complex types, every value source exercised with its precedence proven rung by rung, shared expressions defined once as locals, and a described output surface with sensitive redaction - consumed to stand up a working deployment from external parameters.

About this path

This path starts with writing Terraform configuration: HCL and providers, then variables, outputs and locals. You work in a Linux terminal, so you should be comfortable running basic commands there. No earlier Terraform experience is needed. The variables module ends with a parameterized deployment driven by typed inputs.

Frequently asked questions

4

What will I practice in this path?

2 modules: HCL Fundamentals & Providers and Variables, Outputs & Locals.

How many challenges are there, and how hard are they?

8 challenges, all easy.

What does this path run on?

Challenges run on Terraform 1.15 and Linux CLI.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.