Resource dependencies
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- The dependency graph and implicit dependencies
- Explicit dependencies with depends_on
- Replacement order and the lifecycle block
- How this appears on the exam
The four lifecycle meta-argument settings
| Setting | create_before_destroy | prevent_destroy | replace_triggered_by | ignore_changes |
|---|---|---|---|---|
| What it changes | New object created before the old one is destroyed | Any plan that would destroy the object is rejected | Forces replacement when referenced items change | Suppresses in-place update proposals |
| When it acts | During a forced replacement | At plan time, on any destroy of this object | At plan time, when a referenced item changes | At plan time, on updates only (never on create) |
| Value it takes | true or false | true or false | List of managed-resource references | List of attribute references, or the keyword all |
| Typical use | Zero-downtime replacement | Guard a stateful data store | Rebuild on an unreferenced change | Ignore out-of-band drift |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.