Interview Prep/Terraform/Lifecycle, Dependencies, Provisioners and Drift

How do `precondition` and `postcondition` differ?

IntermediateConceptLifecycle, Dependencies, Provisioners and Drift
Answer

A precondition is checked before the resource is planned or applied and validates its inputs and assumptions ("the AMI must be x86_64"). A postcondition runs after and validates the result ("the subnet must have a public IP"). Both fail the run with your error_message. They can also sit on data sources and outputs.

All Terraform questions Roadmap: Terraform in production

More on Lifecycle, Dependencies, Provisioners and Drift