You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enabling set -uo pipefail in v2.3.0 (bin/terraform.sh:8)
exposed several pre-existing unguarded variable references that only crash on
specific, previously-tolerated code paths. This is a tracking issue grouping
the individual defects so they can be resolved together as a single, coherent
"complete the set -u hardening" pass and verified end-to-end.
This tracker is not a separate defect — the actual bugs and their fixes live in
the child issues below.
All four share a single cause class: set -u was switched on without a full
sweep for references that can be reached while unset. They are distinct root
causes with distinct fixes, but they interact and are cheapest to fix and
verify as one unit:
Ensures environment and component are always defined (even if empty) so
the existing [ -n "${var}" ] presence checks behave, and audits the S3
path constructions in bootstrap mode (secrets/remote-vars lookups) — these
arguably should be skipped entirely when bootstrap == 'true'.
Initialises tf_var_file_paths as =() and guards the zero-element cat "${tf_var_file_paths[@]}" at bin/terraform.sh:606.
Summary
Enabling
set -uo pipefailin v2.3.0 (bin/terraform.sh:8)exposed several pre-existing unguarded variable references that only crash on
specific, previously-tolerated code paths. This is a tracking issue grouping
the individual defects so they can be resolved together as a single, coherent
"complete the
set -uhardening" pass and verified end-to-end.This tracker is not a separate defect — the actual bugs and their fixes live in
the child issues below.
Child issues
${@}unbound atbin/terraform.sh:284 when no
--args are supplied)-ecrashes withenvironment: unbound variabletf_var_file_pathsarray crashes withunbound variablewhen no tfvars files exist-a shellcrashes withcomponent: unbound variableWhy group them
All four share a single cause class:
set -uwas switched on without a fullsweep for references that can be reached while unset. They are distinct root
causes with distinct fixes, but they interact and are cheapest to fix and
verify as one unit:
parsing). Until it is fixed, a bootstrap run cannot even reach Bootstrap without -e crashes with "environment: unbound variable" under set -u #50/Bootstrap with -a shell crashes with "component: unbound variable" under set -u #52, so
those cannot be verified end-to-end in isolation. Unbound variable access breaks deployment #49 is effectively a
prerequisite for validating the others via the documented bootstrap workflow.
environment) and Bootstrap with -a shell crashes with "component: unbound variable" under set -u #52 (component)are the same pattern — variables declared only in the non-bootstrap branch
(bin/terraform.sh:316-331) but referenced bare
in bootstrap mode.
=()initialiser),while the v2.3.0 hardening commit already demonstrated the intended guard
style at bin/terraform.sh:357
(
[ -n "${environment:-}" ]) — it was simply applied to one line and noothers.
Suggested approach
Treat this as one focused hardening PR (or a short series) that:
environmentandcomponentare always defined (even if empty) sothe existing
[ -n "${var}" ]presence checks behave, and audits the S3path constructions in bootstrap mode (secrets/remote-vars lookups) — these
arguably should be skipped entirely when
bootstrap == 'true'.tf_var_file_pathsas=()and guards the zero-elementcat "${tf_var_file_paths[@]}"at bin/terraform.sh:606.shell-in-bootstrap message (Bootstrap with -a shell crashes with "component: unbound variable" under set -u #52), likely by switching to thealways-set
${component_name}.${var}references reachable while unset, so we don't file a fifth issue next month.
Verification
After the fixes, the documented README bootstrap workflow (no
-e, no-c,minimal/empty
etc/) should run cleanly:…with no
unbound variableaborts, and without needing a dummy-- <arg>workaround.
Related
Individual defects: #49, #50, #51, #52.