Interview Prep/Terraform/Lost, Corrupted and Drifted State

Plan output shows `# (12 unchanged attributes hidden)` and you can't see why a resource changes.

BeginnerTroubleshootingLost, Corrupted and Drifted State
Answer

Likely causes → Terraform hides unchanged attributes by default. The change may be in a nested block or a sensitive value.

Diagnose →

terraform plan -out=tfplan
terraform show -json tfplan | jq '.resource_changes[] | select(.address=="aws_lb.main") | .change | {before, after}'

Fix → Use the JSON output to see full before/after values and which attributes are after_unknown.

Prevent → In CI, publish the JSON plan as an artifact and render it with a diff tool for reviewers.

All Terraform questions Roadmap: Terraform in production

More on Lost, Corrupted and Drifted State