Terraform & IaCOptional

Workspaces & Environments

Manage multiple environments cleanly.

25 min read intermediate 3 objectives

Status

Not started

What you will learn

  • Separate dev/stage/prod
  • Use workspaces or directories
  • Avoid state collisions

New to this? Start here

The basics, in plain English

You usually have multiple environments: a dev playground, a staging copy, and production. You want the same infrastructure shape in each, with small differences. Terraform offers ways to manage these separately and safely.

Environment
A separate copy of your infrastructure, such as dev, staging, or production.
Workspace
A Terraform feature for keeping separate state per environment.
Promotion
Moving a tested change from dev up to staging and then to production.
Drift
When the real infrastructure no longer matches your files, often from manual edits.
Parity
Keeping environments as similar as possible so dev results predict production.
01

Many envs

Keep environments isolated with separate state. Workspaces are one option; many teams prefer separate directories or backends for clarity.

Finished this topic?

Mark it done to earn 100 XP and keep your streak alive.