Terraform Graph Complexity Calculator
Score the complexity of a Terraform dependency graph from nodes and edges.
About Terraform Graph Complexity Calculator
Terraform builds a dependency graph of every resource, module and data source, then walks it to determine safe apply order. Formula: graph_complexity = nodes + edges. The parallelizable share (independent_resources / total) estimates how much of an apply can run concurrently — a graph with many independent leaf resources parallelizes well, while one with long dependency chains forces mostly-serial applies regardless of the `-parallelism` setting.
Formulas
Graph complexity
graph_complexity = nodes + edges
- nodes
- Resources/modules/data sources as graph nodes
- edges
- Dependency relationships between nodes
Parallelizable share
parallelizable_percent = (independent_resources / total_nodes) × 100
- independent_resources
- Resources with no dependency on another in the same apply
- total_nodes
- Total graph nodes
Worked example
With the default values below, Terraform Graph Complexity Calculator returns Graph Complexity of 440. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Graph Nodesaccepts 0–10,000,000 nodes
- 180 nodes
- Graph Edgesaccepts 0–10,000,000 edges
- 260 edges
- Independent Resourcesaccepts 0–10,000,000 resources
- 60 resources
Results
- Graph Complexity
- 440
- Parallelizable Resources
- 33.3%
- Complexity Level
- Complex
- Avg Edges per Node
- 1.44
Step by step
- 1Graph complexity: nodes + edges= 440
- 2Parallelizable %: independent / total nodes= 33.3%
Assumptions and limits
- The result is derived only from the 3 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
How do I see my actual dependency graph?
Run `terraform graph` to get DOT output, then render it with Graphviz (`dot -Tsvg`) — for large configurations, filter to a subset with `-type=plan` or focus on specific modules to keep it readable.
Why doesn't increasing parallelism always speed up applies?
Parallelism only helps for resources that don't depend on each other. If most of your graph is a long serial chain (e.g. VPC → subnet → security group → instance), no amount of `-parallelism` bypasses that ordering constraint.
What increases graph complexity unnecessarily?
Implicit dependencies created by referencing entire objects/modules (`module.vpc`) instead of specific attributes (`module.vpc.subnet_id`) can create edges that aren't strictly required, serializing resources that could otherwise apply in parallel.
Does higher graph complexity always mean slower applies?
Not directly — it's a proxy for reasoning complexity and coordination overhead. Actual apply time depends more on the parallelizable share and per-resource provisioning time (see the apply time calculator).
Related Calculators
- Terraform Module Dependency Calculator
- Terraform Apply Time Calculator
- Terraform Plan Complexity Calculator
- Terraform Backend Storage Calculator
- Terraform Cloud Cost Calculator
- Terraform Drift Calculator
- Terraform Infrastructure Score Calculator
- Terraform Lock Timeout Calculator
- Terraform Refresh Duration Calculator
- Terraform Resource Count Calculator
You might also need
- Terraform Module Dependency CalculatorCommonly used together
- Terraform Plan Complexity CalculatorCommonly used together
- Terraform Apply Time CalculatorCommonly used together
- Terraform Resource Count CalculatorAlso in Terraform
- Terraform Variable Size CalculatorAlso in Terraform
- Terraform Drift CalculatorAlso in Terraform
