Custom condition validation
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 shared shape of a custom condition
- Variable validation
- Preconditions and postconditions
- Check blocks and assertions
- How this appears on the exam
Terraform custom-condition mechanisms
| Aspect | Variable validation | Precondition / postcondition | Check block |
|---|---|---|---|
| Declared in | The variable block | A lifecycle block, or an output | A top-level check block |
| Runs | Before the plan | Precondition before, postcondition after create/update | Last, after plan or apply |
| On failure | Error, halts the run | Error, halts the run and blocks dependents | Warning, run continues |
| The self object | Not available | Available in a postcondition | Not available |
| Introduced | v0.13 | v1.2 | v1.5 |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.