terraform/internal/configs/testdata/valid-files
Alisdair McDiarmid b06fe04621 core: Check rule error message expressions
Error messages for preconditions, postconditions, and custom variable
validations have until now been string literals. This commit changes
this to treat the field as an HCL expression, which must evaluate to a
string. Most commonly this will either be a string literal or a template
expression.

When the check rule condition is evaluated, we also evaluate the error
message. This means that the error message should always evaluate to a
string value, even if the condition passes. If it does not, this will
result in an error diagnostic.

If the condition fails, and the error message also fails to evaluate, we
fall back to a default error message. This means that the check rule
failure will still be reported, alongside diagnostics explaining why the
custom error message failed to render.

As part of this change, we also necessarily remove the heuristic about
the error message format. This guidance can be readded in future as part
of a configuration hint system.
2022-03-04 15:35:39 -05:00
..
backend.tf
cloud.tf Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
data-sources.tf
empty.tf
empty.tf.json
locals.tf
locals.tf.json
outputs.tf
provider-configs.tf
providers-explicit-implied.tf
references.tf.json
required-providers.tf
required-version.tf
resources-ignorechanges-all.tf
resources-ignorechanges-all.tf.json
resources.tf
valid-language-edition.tf
variable_validation.tf core: Check rule error message expressions 2022-03-04 15:35:39 -05:00
variables.tf configs: explicitly nullable variable values 2021-10-29 13:59:46 -04:00
variables.tf.json