File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -335,11 +335,15 @@ Error: Resource postcondition failed
335335The selected AMI must be tagged with the Component value "nomad-server".
336336```
337337
338- The ` error_message ` argument must always be a literal string, and should
339- typically be written as a full sentence in a style similar to Terraform's own
340- error messages. Terraform will show the given message alongside the name
341- of the resource that detected the problem and any outside values used as part
342- of the condition expression.
338+ The ` error_message ` argument can be any expression which evaluates to a string.
339+ This includes literal strings, heredocs, and template expressions. Multi-line
340+ error messages are supported, and lines with leading whitespace will not be
341+ word wrapped.
342+
343+ Error message should typically be written as one or more full sentences in a
344+ style similar to Terraform's own error messages. Terraform will show the given
345+ message alongside the name of the resource that detected the problem and any
346+ outside values used as part of the condition expression.
343347
344348## Preconditions or Postconditions?
345349
Original file line number Diff line number Diff line change @@ -198,10 +198,13 @@ variable "image_id" {
198198```
199199
200200If ` condition ` evaluates to ` false ` , Terraform will produce an error message
201- that includes the sentences given in ` error_message ` . The error message string
201+ that includes the result of the ` error_message ` expression . The error message
202202should be at least one full sentence explaining the constraint that failed,
203203using a sentence structure similar to the above examples.
204204
205+ Error messages can be literal strings, heredocs, or template expressions. The
206+ only valid reference in an error message is the variable under validation.
207+
205208Multiple ` validation ` blocks can be declared in which case error messages
206209will be returned for _ all_ failed conditions.
207210
You can’t perform that action at this time.
0 commit comments