mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
Rename page in sidebar and change filename
This commit is contained in:
parent
2449fadf06
commit
42d73fe324
@ -280,8 +280,8 @@
|
||||
"path": "expressions/version-constraints"
|
||||
},
|
||||
{
|
||||
"title": "Pre and Postconditions",
|
||||
"path": "expressions/preconditions-postconditions"
|
||||
"title": "Custom Data Validation",
|
||||
"path": "expressions/custom-data-validation"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -6,13 +6,13 @@ description: >-
|
||||
|
||||
# Custom Data Validation
|
||||
|
||||
You can create validation checks for configuration requirements that return detailed error messages to consumers. Custom validations are optional, but they can help capture assumptions that might be only implied, helping future maintainers understand the configuration design and intent. They also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations.
|
||||
You can create validation checks with custom error messages for several types of objects in a configuration. Custom validations are optional, but they can help capture assumptions that might be only implied, helping future maintainers understand the configuration design and intent. They also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations.
|
||||
|
||||
You can create custom validations with the following types of expressions.
|
||||
- Add [`validation` blocks](input-variable-validation) inside input `variable` blocks.
|
||||
- Add []`precondition` and `postcondition`](#preconditions-and-postconditions) blocks inside `lifecycle` blocks and `precondition` blocks inside `output blocks`.
|
||||
- Add [`precondition` and `postcondition`](#preconditions-and-postconditions) blocks inside `lifecycle` blocks and `precondition` blocks inside `output blocks`.
|
||||
|
||||
The `validation`, `precondition`, and `postcondition` blocks all require a [`condition` attribute](#condition-expressions) that describes the validation requirements and an [`error_message` attribute](#error-messages) that contains explanatory text that Terraform will display to the user.
|
||||
All of these methods require a [`condition` attribute](#condition-expressions) that describes the validation requirements and an [`error_message` attribute](#error-messages) that contains explanatory text that Terraform will display to the user.
|
||||
|
||||
-> **Note:** Input variable validation is available in Terraform CLI v0.13.0 and later. Preconditions and postconditions are available in Terraform CLI v1.2.0 and later.
|
||||
|
||||
@ -135,7 +135,7 @@ We recommend also considering the following factors.
|
||||
- Whether it is helpful to declare the same or similar conditions as both preconditions and postconditions. This can be useful if the postcondition is in a different module than the precondition because it lets the modules verify one another as they evolve independently.
|
||||
|
||||
|
||||
## Usage Examples
|
||||
### Usage Examples
|
||||
|
||||
The following example shows possible uses for variable validation, preconditions and postconditions.
|
||||
|
||||
@ -257,8 +257,6 @@ Condition expressions have the following requirements.
|
||||
You can use any of Terraform's built-in functions or language operators
|
||||
in a condition as long as the expression is valid and returns a boolean result.
|
||||
|
||||
## Common Condition Expression Features
|
||||
|
||||
Because condition expressions must produce boolean results, they can often
|
||||
use built-in functions and language features that are less common elsewhere
|
||||
in the Terraform language. The following language features are particularly
|
Loading…
Reference in New Issue
Block a user