Content Deep Dive
Terraform Custom Conditions – Preconditions & Postconditions
Blog post from Spacelift
Post Details
Company
Date Published
Author
Derek Morgan
Word Count
1,755
Language
English
Hacker News Points
-
Summary
Terraform has introduced "preconditions" and "postconditions" in version 1.2.0 to validate deployments more effectively. Preconditions are used with assumptions, while postconditions are used with guarantees. These conditions can be added to the lifecycle block of a resource and include four parts: lifecycle block, precondition or postcondition block, condition, and error message. They provide greater flexibility in validating resources and ensuring deployments adhere to specific requirements.