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.
More on Lifecycle, Dependencies, Provisioners and Drift
What are meta-arguments?BeginnerWhat lifecycle options are available?BeginnerHow does `create_before_destroy` work and what can go wrong?AdvancedWhat does `prevent_destroy` guarantee and what does it not?AdvancedWhen do you use `ignore_changes`?IntermediateWhat does `replace_triggered_by` do?Advanced