Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

`Workspace "staging" doesn't exist. You can create this workspace with the "new" subcommand.` in CI.

BeginnerTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → Fresh backend key, wrong backend config, or a typo in the workspace name.

Diagnose → terraform workspace list

Fix → terraform workspace select -or-create staging (Terraform 1.4+), or check the backend first if it should already exist.

Prevent → Use select -or-create only for ephemeral environments; for long-lived ones, a missing workspace should fail loudly (it often means the wrong backend).

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces