assertion
Invicton-Labs/assertion/null
A simple module that asserts (during planning) that a condition is true, and prints a custom error message if not.
Terraform Assertion A simple module that asserts that one or more conditions are true. The assertion is checked during planning, unless the condition depends on a value that will only be known during apply. The module forces Terraform to fail if the condition is false by using a Terraform variable with a validation condition, with the desired error message as the variable validation error message. Usage `` module "assertion_unix_only" { source = "Invicton-Labs/assertion/null" // The condition to ensure is TRUE // In this example, assert that the operating system uses forward slashes for path separators condition = dirname("/") == "/" // The error message to print out if the condition evaluates to FALSE error_message = "This Terraform configuration can only be run on Unix-based machines." }
| Name | Type | Description | Default |
|---|---|---|---|
| error_message | string | The error message to display if the condition evaluates to `false`. | null |
| condition | bool | The condition to ensure is `true`. | null |
| assertions | list(object({ condition | A list of conditions and error message pairs to check. This is for use when you | null |
error_message — The value of the `error_message` input variable.condition — The value of the `condition` input variable.assertions — The value of the `assertions` input variable.checked — Whether the condition has been checked (used for assertion dependencies).