Skip to content
ENExplore Calculators

Terraform Plan Complexity Calculator

Score the complexity of a Terraform plan from resource changes and dependencies.

About Terraform Plan Complexity Calculator

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)

Worked example

With the default values below, Terraform Plan Complexity Calculator returns Plan Complexity Score of 45. Change any input above and every figure here is recalculated in your browser.

Inputs used

Resources to Createaccepts 0–1,000,000 resources
12 resources
Resources to Updateaccepts 0–1,000,000 resources
8 resources
Resources to Destroyaccepts 0–1,000,000 resources
3 resources
Resources to Replaceaccepts 0–1,000,000 resources
2 resources

Results

Plan Complexity Score
45
Risk Level
High
Total Resource Changes
25 resources
Avg Complexity per Resource
1.80

Step by step

  1. 1Complexity: creates×1 + updates×2 + destroys×3 + replacements×4= 45
  2. 2Total resource changes= 25 resources

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

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.

Terraform Plan Complexity Calculator | Calcrivo