Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick authored Jul 13, 2021
1 parent f556ea1 commit b364510
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
# Terraform Assertion
A simple module that asserts (during planning) that a condition is true.
A simple module that asserts that a condition is 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 attempting to call a non-existant external command. It uses the error message in the command name so that the resulting Terraform failure message is descriptive (although it is slightly confusing in the format; see the example below).

## 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."
}
```

Output on Unix machines:
```
No changes. Your infrastructure matches the configuration.
```

Output on Windows machines:
```
Error: can't find external program "ERROR: This Terraform configuration can only be run on Unix-based machines."
```

0 comments on commit b364510

Please sign in to comment.