Many teams read each other's outputs via `terraform_remote_state`. What problems appear, and how do you fix them?
IntermediateScenarioState Backends and Workspaces
Answer
Situation read → Hidden coupling.
What I'd do →
- List who reads what; ensure readers use a read-only role.
- Treat outputs as a versioned contract and don't rename without a deprecation window.
- Move high-value shared values to SSM or a service catalog, with explicit ownership.
Why → Anyone with remote_state access can read the entire state, including secrets, and renames silently break downstream plans.
Interview tip → Mention "contract" and "least privilege".
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