Terraform Plan Complexity Calculator
Score a Terraform plan's complexity from its mix of creates, updates, destroys and forced replacements.
Inputs
Count of resources the plan will create (+).
Count of resources the plan will update in-place (~).
Count of resources the plan will destroy (-).
Count of resources requiring destroy-and-recreate (-/+).
Plan Complexity Score
45
Risk Level
High
Total Resource Changes
25resources
Avg Complexity per Resource
1.80
Step by step
Complexity: creates×1 + updates×2 + destroys×3 + replacements×4
12×1 + 8×2 + 3×3 + 2×4
= 45
Total resource changes
12 + 8 + 3 + 2
= 25 resources
How it works
Not all plan changes carry equal risk. Formula: complexity = creates×1 + updates×2 + destroys×3 + replacements×4 — the weights reflect that in-place updates carry more risk than pure additions, destroys carry more risk than updates (data loss potential), and forced replacements (destroy-then-recreate) carry the most risk since they combine both destructive and additive risk with possible downtime.
Formula
complexity = creates × 1 + updates × 2 + destroys × 3 + replacements × 4
- creates
- Resources to create (weight 1)
- updates
- Resources to update in-place (weight 2)
- destroys
- Resources to destroy (weight 3)
- replacements
- Resources requiring destroy-and-recreate (weight 4)
Frequently Asked Questions
Why do replacements get the highest weight?
A replacement means Terraform must destroy the existing resource and create a new one to apply a change — this can cause downtime, lose non-exported state (like an IP address or generated ID), and is often triggered by a change the author didn't anticipate would force it.
How do I see whether a plan includes forced replacements?
Run `terraform plan` and look for the `-/+` prefix (destroy and re-create) on resources — Terraform explicitly annotates which changes force replacement versus a safe in-place update.
What should I do with a high complexity score before applying?
Request an additional reviewer, run the plan against a non-production workspace first if possible, and double-check any resources marked for replacement for data loss risk (e.g. databases, stateful storage).
Does resource count alone predict plan risk?
Not well — ten straightforward creates are far lower risk than two forced replacements of a production database, which is why this calculator weights by change type rather than just counting resources.
You might also need
- Terraform Graph Complexity CalculatorCommonly used together
- Terraform Variable Size CalculatorCommonly used together
- Terraform Infrastructure Score CalculatorCommonly used together
- Terraform Drift CalculatorCommonly used together
- Terraform Module Dependency CalculatorCommonly used together
- Terraform Resource Count CalculatorAlso in Terraform