In HCP Terraform, how do you manage 40 workspaces that need the same AWS credentials and tags?
IntermediateScenarioState Backends and Workspaces
Answer
Situation read → Repeated variables across workspaces.
What I'd do →
- Create a variable set with the shared environment variables (preferably dynamic provider credentials via OIDC, not static keys).
- Apply the set to a project or to all workspaces.
- Keep workspace-specific values on the workspace.
Why → One place to rotate or change, and no keys copied by hand.
Interview tip → Dynamic credentials give per-run short-lived tokens.
More on State Backends and Workspaces
Two engineers keep overwriting each other's changes because state is local. What's the fix?BeginnerSet up a production-grade S3 backend. What do you configure for locking?IntermediateHow do you harden the S3 bucket that holds Terraform state?IntermediateWho creates the state bucket itself, given Terraform needs it to exist before `init`?IntermediateA laptop apply and a CI apply start at the same time. What stops state corruption?IntermediateWhen are Terraform workspaces appropriate?Beginner