mailserver: guard alias filter against short lines with a lazy ternary
Some checks failed
ci/woodpecker/push/default Pipeline was canceled
Some checks failed
ci/woodpecker/push/default Pipeline was canceled
CI pipeline 469 failed with 'Invalid index' on the postfix_virtual alias
filter: terraform only short-circuits &&/|| from v1.6, and the older
terraform in the infra-ci image still evaluated split(" ", line)[1] for
the blank and comment lines that have been in extra/aliases.txt since the
plans@ block. The devvm's newer terraform short-circuits, which is why the
local apply of the same commit passed. A conditional expression is lazy on
every terraform version, so move the length guard into a ternary.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
68b9858eff
commit
4ee4d1927d
1 changed files with 7 additions and 2 deletions
|
|
@ -14,10 +14,15 @@ variable "nfs_server" { type = string }
|
|||
locals {
|
||||
_account_set = keys(var.mailserver_accounts)
|
||||
_virtual_lines = split("\n", format("%s%s", var.postfix_account_aliases, file("${path.module}/extra/aliases.txt")))
|
||||
# NOTE: the length guard must live in a ternary, not a leading `&&` operand.
|
||||
# Terraform only short-circuits && / || from v1.6 — on the older terraform
|
||||
# pinned in the infra-ci image, `split(" ", line)[1]` was still evaluated
|
||||
# for blank/comment lines and failed the whole plan with "Invalid index"
|
||||
# (first hit by CI pipeline #469, 2026-07-03). A conditional expression is
|
||||
# lazy on every terraform version.
|
||||
postfix_virtual = join("\n", [
|
||||
for line in local._virtual_lines : line
|
||||
if !(
|
||||
length(split(" ", line)) == 2 &&
|
||||
if length(split(" ", line)) != 2 ? true : !(
|
||||
contains(local._account_set, split(" ", line)[0]) &&
|
||||
contains(local._account_set, split(" ", line)[1]) &&
|
||||
split(" ", line)[0] != split(" ", line)[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue