terraform: Infrastructure as Code, the Core Loop
Learn the Terraform core workflow hands-on — write HCL, init providers, plan, apply, inspect state, parameterise with variables and outputs, loop with for_each, and destroy. No cloud account required.
Terraform turns infrastructure into code you can read, review and re-run. This course walks the core loop one small move at a time: you write a tiny configuration, initialise its providers, format and validate it, preview the change with plan, apply it, and read the state Terraform keeps. From there we make the config real — variables, a tfvars file, outputs, the console, and a for_each loop — and finish by saving a plan, targeting a single resource, and tearing everything down with destroy. Everything runs against the local and random providers, so there are no credentials and nothing to clean up in the cloud: just real Terraform, end to end.
What you'll build
- Write a Terraform configuration and initialise its providers
- Format, validate and preview changes with fmt, validate and plan
- Apply changes and read the state Terraform records
- Parameterise a config with variables, tfvars and outputs
- Create many resources at once with for_each
- Save a plan, target a resource, and destroy what you built
Contents
- Check your Terraform
- Describe what you want
- Initialise the project
- Tidy the formatting
- Check it makes sense
- Preview the change
- Apply it
- See what it made
- Read the recorded state
- List what's tracked
- Inspect one resource
- Make the greeting a variable
- Wire the variable in
- Plan an override
- Set values in a file
- Apply the new value
- Confirm the change
- Declare some outputs
- Read the outputs
- Read a single output
- Open the console
- Evaluate expressions
- Make many at once
- Plan the loop
- Save a plan
- Apply the saved plan
- See the full inventory
- Target one resource
- Tear it all down
- Decide what to commit