Require Terraform across dev scripts

This commit is contained in:
beatz174-bit
2026-04-29 14:34:41 +10:00
parent 5130797008
commit 4fcf388092
3 changed files with 19 additions and 17 deletions
+7 -7
View File
@@ -5,7 +5,7 @@ MIN_GO_VERSION="1.23.0"
MIN_TERRAFORM_VERSION="1.5.0"
FIX_MODE=0
STRICT_MODE=0
STRICT_MODE=1
log() {
echo "[setup-dev] $*"
@@ -21,11 +21,11 @@ error() {
usage() {
cat <<USAGE
Usage: ./scripts/setup-dev.sh [--fix] [--strict] [--help]
Usage: ./scripts/setup-dev.sh [--fix] [--no-strict] [--help]
Modes:
--fix Validate and attempt safe remediation via already-installed version managers.
--strict Treat missing Terraform as an error.
--no-strict Allow missing Terraform (not recommended; legacy compatibility mode).
--help Show this help text.
USAGE
}
@@ -35,8 +35,8 @@ while [[ $# -gt 0 ]]; do
--fix)
FIX_MODE=1
;;
--strict)
STRICT_MODE=1
--no-strict)
STRICT_MODE=0
;;
--help|-h)
usage
@@ -273,10 +273,10 @@ validate_terraform() {
if [[ -z "$TERRAFORM_PATH" ]]; then
if (( STRICT_MODE == 1 )); then
error "terraform not found in PATH (required in --strict mode)"
bad=1
else
warn "terraform not found in PATH (required for validate/acceptance workflows)"
warn "terraform not found in PATH (allowed only because --no-strict was set)"
fi
bad=1
return "$bad"
fi