Archived
Merge pull request #43 from beatz174-bit/codex/make-terraform-mandatory-in-environment-setup
Require Terraform as mandatory tool in dev scripts
This commit is contained in:
+6
-5
@@ -26,11 +26,12 @@ go vet ./...
|
|||||||
echo "[check] running go test"
|
echo "[check] running go test"
|
||||||
go test ./...
|
go test ./...
|
||||||
|
|
||||||
if command -v terraform >/dev/null 2>&1; then
|
if ! command -v terraform >/dev/null 2>&1; then
|
||||||
echo "[check] running terraform fmt check for examples/"
|
echo "[check][error] terraform not found in PATH" >&2
|
||||||
terraform fmt -check -recursive examples
|
exit 1
|
||||||
else
|
|
||||||
echo "[check][warn] terraform not found; skipping examples/ checks" >&2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[check] running terraform fmt check for examples/"
|
||||||
|
terraform fmt -check -recursive examples
|
||||||
|
|
||||||
echo "[check] complete"
|
echo "[check] complete"
|
||||||
|
|||||||
+6
-5
@@ -18,11 +18,12 @@ fi
|
|||||||
echo "[fix] running go mod tidy"
|
echo "[fix] running go mod tidy"
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|
||||||
if command -v terraform >/dev/null 2>&1; then
|
if ! command -v terraform >/dev/null 2>&1; then
|
||||||
echo "[fix] running terraform fmt for examples/"
|
echo "[fix][error] terraform not found in PATH" >&2
|
||||||
terraform fmt -recursive examples
|
exit 1
|
||||||
else
|
|
||||||
echo "[fix][warn] terraform not found; skipping examples/ formatting" >&2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[fix] running terraform fmt for examples/"
|
||||||
|
terraform fmt -recursive examples
|
||||||
|
|
||||||
echo "[fix] complete"
|
echo "[fix] complete"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ MIN_GO_VERSION="1.23.0"
|
|||||||
MIN_TERRAFORM_VERSION="1.5.0"
|
MIN_TERRAFORM_VERSION="1.5.0"
|
||||||
|
|
||||||
FIX_MODE=0
|
FIX_MODE=0
|
||||||
STRICT_MODE=0
|
STRICT_MODE=1
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
echo "[setup-dev] $*"
|
echo "[setup-dev] $*"
|
||||||
@@ -21,11 +21,11 @@ error() {
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<USAGE
|
cat <<USAGE
|
||||||
Usage: ./scripts/setup-dev.sh [--fix] [--strict] [--help]
|
Usage: ./scripts/setup-dev.sh [--fix] [--no-strict] [--help]
|
||||||
|
|
||||||
Modes:
|
Modes:
|
||||||
--fix Validate and attempt safe remediation via already-installed version managers.
|
--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.
|
--help Show this help text.
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
@@ -35,8 +35,8 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--fix)
|
--fix)
|
||||||
FIX_MODE=1
|
FIX_MODE=1
|
||||||
;;
|
;;
|
||||||
--strict)
|
--no-strict)
|
||||||
STRICT_MODE=1
|
STRICT_MODE=0
|
||||||
;;
|
;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
usage
|
usage
|
||||||
@@ -275,7 +275,7 @@ validate_terraform() {
|
|||||||
error "terraform not found in PATH (required in --strict mode)"
|
error "terraform not found in PATH (required in --strict mode)"
|
||||||
bad=1
|
bad=1
|
||||||
else
|
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
|
fi
|
||||||
return "$bad"
|
return "$bad"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user