Terraform Workspace is a separate Terraform state namespace using the same configuration to maintain multiple logical instances of the same code.
Simple definition
Terraform Workspace is a separate Terraform state namespace using the same configuration to maintain multiple logical instances of the same code. It belongs to the Cloud / DevOps vocabulary and is useful when reading architecture diagrams, product documentation, logs, or administration procedures.
What is it used for?
Its main purpose is to separate some environments or variants without immediately duplicating all configuration files. The practical value depends on the surrounding architecture, security model, and operational requirements.
How does it work?
Each workspace has its own state for the same configuration directory. The active selection determines which state is read and modified.
Key points
- Scope: A separate Terraform state namespace using the same configuration to maintain multiple logical instances of the same code.
- Operational goal: Separate some environments or variants without immediately duplicating all configuration files.
- Implementation: Each workspace has its own state for the same configuration directory. The active selection determines which state is read and modified.
Points to watch
Protect state, pin versions, and review plans; IaC automation can propagate a configuration error very quickly.
In short
Terraform Workspace = a separate Terraform state namespace using the same configuration to maintain multiple logical instances of the same code. Use it when you need to separate some environments or variants without immediately duplicating all configuration files.