Use it when configuring, checking or troubleshooting Dependencies in Infrastructure as Code.
Dependencies · Infrastructure as Code
IaC dependencies define graph ordering and value flow through references and, where necessary, explicit dependency declarations.
1. Dependencies come from references; depends_on for hidden ones.
2. Graph shows ordering.
3. Avoid unnecessary depends_on (slows plans).
4. Cross-stack via remote state/data.
5. Watch cycles.
reference → dependency edge → ordered apply
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
Healthy evidence: Dependencies are minimal, explainable and produce the expected graph/order without unnecessary serialization.
Step 2 Failure modes and next checks Narrow the fault
Suspicious evidence: Hidden external dependencies, broad explicit dependencies or readiness assumptions create unknown values, ordering surprises or race conditions.
Graph dependency ≠ readiness dependency; object creation order does not guarantee that a service is operational when a downstream object starts.
Step 3 Common mistakes Narrow the fault
- Overusing
depends_on, slowing plans. - Hidden dependencies via provisioners or external scripts.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Graph dependency ≠ readiness dependency; object creation order does not guarantee that a service is operational when a downstream object starts.
- State or engine metadata ≠ authoritative live-service health; always confirm with provider read-back and target acceptance checks.
- A green execution step ≠ complete convergence when later state persistence, external dependencies or workload readiness remain unverified.
- Provider/API success ≠ business outcome; keep engine evidence and target-domain evidence separate.
terraform graph | dot -Tsvg > graph.svg— dependency graph- Implicit references preferred — ordering
- depends_on only when needed — explicit deps
ReferenceWhat it is1 section · depth on demand
What it is
IaC tools build a dependency graph from references between resources and create/destroy in the right order. Use explicit depends_on only for hidden dependencies.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Dependencies in IaC decide the order in which resources are created, updated and destroyed. Tools infer most of them from references between resources and create independent resources in parallel; destruction happens in reverse order.
| Kind | Example |
|---|---|
| Implicit (reference) | Subnet references the VPC ID |
| Explicit | depends_on in Terraform, DependsOn in CloudFormation |
| Cross-stack | Outputs of one stack used by another |
Hidden dependencies — a resource that relies on another through a name or DNS rather than a reference — cause intermittent failures where the order happens to be wrong. Make them explicit, and split very large configurations into stacks with clearly defined interfaces.
Example
terraform graph | dot -Tsvg > graph.svg
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Infrastructure as Code > Dependencies. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://opentofu.org/docs/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Dependencies IaC proof-boundary map
Fast definition/state/plan/execution/target-proof boundaries for Dependencies.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Definition / inputs | Exact revision, toolchain and effective inputs are reproducible | Different runner/version/input context changes evaluation |
| State / planning | Correct backend/state/lock, fresh reads and reviewed graph/plan | Wrong state/workspace, stale reads, unsafe replacement/destroy or missing lock |
| Execution | Expected provider/API operations complete and state persists | Partial apply, auth/API error, ambiguous retry or failed state write |
| Target proof | Independent read-back plus fresh plan confirm intended convergence | Engine success treated as workload acceptance or drift remains unexplained |