The problem: a plan nobody could safely approve
- The enterprise IAM module needed a major-version upgrade across 30+ AWS accounts.
- The first plans were enormous: in the worst account folder, hundreds of planned destroys.
- In IAM, a destroy can mean someone loses access to production. An approver facing hundreds of them has two bad options: approve without reading, or block the upgrade.
- Most of those destroys weren't real changes. They were plan noise: resources Terraform wanted to replace only because names or addresses had drifted.
The approach: make the plan tell the truth before anyone approves it
- Classify every destroy, rather than reviewing the plan as one wall of text.
- Remove the noise with targeted remediation, so only real changes remain.
- Give approvers a classified risk breakdown, not a raw plan.
- Apply through a documented approval gate, account folder by account folder.
What I did
1. Classified every planned destroy
I extracted the destroys from each plan and grouped them by what they actually were. That separated three kinds of change:
| Kind | Decision |
|---|---|
| Removals of static IAM users left by a retired secrets platform | Expected: role-based access had replaced them |
| Policy attachment replacements | Expected |
| Removals of legacy SSO roles | Escalate: could lock out a production team |
Everything else was noise to remove.
Illustrative: listing the destroys in a plan.
terraform plan -out=tfplan
terraform show -json tfplan \
| jq -r '.resource_changes[] | select(.change.actions | index("delete")) | .address' \
| sort > destroys.txt
# Group by resource type to see where the noise is
cut -d. -f1-2 destroys.txt | sed 's/\[.*//' | sort | uniq -c | sort -rn
2. Removed the noise
Targeted remediation for the naming and addressing drift, so resources that only looked new were matched to what already existed instead of being destroyed and recreated. In the worst folder the plan went from hundreds of destroys to a few dozen, and every one left was a change someone could explain.
Illustrative: telling Terraform a resource moved instead of replacing it.
moved {
from = aws_iam_role.app["legacy-name"]
to = aws_iam_role.app["new-name"]
}
3. A classified risk breakdown for approvers
Each apply went to approval with the destroys already sorted into expected, escalate and none left unexplained. Approvers reviewed a short list of real changes instead of a raw plan.
4. A repeatable pattern
The same method ran across multiple account folders: classify, remediate, re-plan, break down the risk, approve, apply, verify access. Access continuity was preserved throughout.
Things to watch
- Re-plan after every remediation. Fixing one kind of noise can surface another. The plan is only "clean" when a fresh plan says so.
- Never approve a destroy you can't name. If a destroy isn't in the expected list, it's either noise to remove or a risk to escalate. There's no third option.
- Verify access after the apply. A clean plan proves intent. Logging in with the affected roles proves the result.
What it solves
- Plans approvers can actually read, so approval means something.
- No surprise lockouts during an identity upgrade across 30+ accounts.
- Less review time, because the noise is removed before review, not argued about during it.
What it doesn't solve
- The cause of the drift. Remediation fixes this upgrade. Naming conventions enforced in the module stop the drift coming back.
- Destroys that are real and risky. The method surfaces them; a human still has to decide.
Checklist
- [ ] Every planned destroy extracted and classified
- [ ] Noise remediated (moved blocks, corrected names), then re-planned
- [ ] Only explainable changes left in the final plan
- [ ] A classified risk breakdown attached to each approval
- [ ] Applied folder by folder through the approval gate
- [ ] Access verified with the affected roles after each apply
Further reading
- Terraform
movedblocks and refactoring (HashiCorp developer docs) terraform show -jsonand the JSON plan format (HashiCorp developer docs)