Files
opentf/internal/configs/testdata/invalid-files/precondition-postcondition-missing-condition.tf
Alisdair McDiarmid 64cf53bd7e configs: Fix check block configuration diagnostics
When validating self-references for resource and data source
preconditions and postconditions, we previously did not nil-check the
block's condition field, which caused a panic when the block had no
condition.

While fixing this I noticed that we were not validating that there are
no self-references in the error message, so fixed that.
2022-06-21 12:13:45 -04:00

13 lines
342 B
HCL

resource "example" "example" {
foo = 5
lifecycle {
precondition { # ERROR: Missing required argument
error_message = "Can a check block fail without a condition?"
}
postcondition { # ERROR: Missing required argument
error_message = "Do not try to pass the check; only realize that there is no check."
}
}
}