Skip to content

Commit

Permalink
fix(docs): incorrect example
Browse files Browse the repository at this point in the history
The example given to illustrate the behaviour of logical operators is incorrect.
`var.foo || var.foo.bar` would also produce an error if the operator  was short-circuiting. The example should be with `var.foo && var.foo.bar`, that produces an error in terraform, but wouldn't if `||` could short-circuit
  • Loading branch information
sehyod committed Jun 20, 2024
1 parent c049964 commit 67d285b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/docs/language/expressions/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ Terraform does not have an operator for the "exclusive OR" operation. If you
know that both operators are boolean values then exclusive OR is equivalent
to the `!=` ("not equal") operator.

The logical operators in Terraform do not short-circuit, meaning `var.foo || var.foo.bar` will produce an error message if `var.foo` is `null` because both `var.foo` and `var.foo.bar` are evaluated.
The logical operators in Terraform do not short-circuit, meaning `var.foo && var.foo.bar` will produce an error message if `var.foo` is `null` because both `var.foo` and `var.foo.bar` are evaluated.

0 comments on commit 67d285b

Please sign in to comment.