Map dependency depth and count across nested Terraform modules.
Module dependency depth is the longest chain of module-to-module references (via `module` blocks consuming another module's outputs). Formula: depth = longest_dependency_chain, measured by walking the module graph. Terraform's graph is required to be acyclic, so true circular dependencies fail at plan time — but a high edge-to-module ratio signals dense coupling that makes refactors risky and increases the chance of hitting one.
edge_to_module_ratio = dependency_edges / total_modules
No — Terraform builds a directed acyclic graph (DAG) and will error out ("Cycle") if module references form a loop. This calculator's circular risk signal is a proxy for how close your coupling is to that failure mode, not a live cycle detector.
Run `terraform graph | dot -Tpng > graph.png` (requires Graphviz) to render the full resource/module dependency graph, or use `terraform graph -type=plan` for a plan-scoped view.
Deep chains mean a change to a foundational module (e.g. a shared networking module) ripples through many downstream modules before you see the final effect, making blast radius harder to reason about and applies slower.
Favor flatter, more independent modules with clear input/output contracts over deeply nested composition, and consider using remote state data sources instead of direct module nesting for cross-cutting concerns like shared VPCs.