Interview Prep/Terraform/Lost, Corrupted and Drifted State

Plans for the `network` stack are clean, but the `app` stack reading it via `terraform_remote_state` fails with `This object does not have an attribute named "private_subnet_ids"`.

IntermediateTroubleshootingLost, Corrupted and Drifted State
Answer

Likely causes → The output was added to the network code but not applied yet, so it's not in its state; or the app reads the wrong key/workspace.

Diagnose →

cd network && terraform output
terraform state pull | jq '.outputs | keys'

Fix → Apply the network stack so the output is written to state, or fix the config.key/workspace in the terraform_remote_state block.

Prevent → Apply producer stacks before consumers in the pipeline. Prefer SSM parameters or data sources with tags for cross-stack contracts.

All Terraform questions Roadmap: Terraform in production

More on Lost, Corrupted and Drifted State