Documentation Index
Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
Use this file to discover all available pages before exploring further.
Errand’s expression syntax is defined by HCL. Expressions appear in computed block expression attributes, task condition and working_dir values, and inside ${} interpolations in command strings.
Operators
Arithmetic
| Operator | Operation |
|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Remainder |
computed "workers" {
expression = var.cpu_count * 2
}
Comparison
| Operator | Operation |
|---|
== | Equal |
!= | Not equal |
< | Less than |
<= | Less than or equal |
> | Greater than |
>= | Greater than or equal |
task "deploy" {
condition = var.replicas > 0
commands = ["kubectl apply -f k8s/"]
}
Logical
| Operator | Operation |
|---|
&& | And |
|| | Or |
! | Not |
task "migrate" {
condition = var.env == "production" && var.run_migrations
commands = ["./bin/migrate up"]
}
Precedence
Operators evaluate in this order, highest to lowest:
| Priority | Operators |
|---|
| Highest | !, - (unary) |
| *, /, % |
| +, - |
| >, >=, <, <= |
| ==, != |
| && |
| Lowest | || |
Use parentheses when order might be ambiguous:
condition = (var.env == "production" || var.env == "staging") && var.ready
Conditional
The ternary operator selects between two values based on a condition:
condition ? value_if_true : value_if_false
task "build" {
commands = [
"go build ${var.debug ? "-race" : ""} ./...",
]
}
Both branches must produce a compatible type.
Index and attribute access
Access list elements by zero-based index:
expression = var.services[0]
Access map and object values by key or dot notation:
expression = var.ports["api"]
expression = var.db.host
Dot notation and bracket notation are equivalent for string keys. Accessing an out-of-bounds index or a missing key is an error at evaluation time.
Function calls
Call a function by name with arguments in parentheses. Functions can be nested:
expression = lower(replace(var.branch, "/", "-"))
All built-in functions are available in every expression context. See the functions reference.
HCL expression language
Errand uses a subset of HCL’s expression language. For expressions, splat expressions ([*]), and template directives (%{if}, %{for}) are not supported (yet).