Skip to content

Commit 5b3036f

Browse files
committed
Add tf-lock hook
1 parent 6a06600 commit 5b3036f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.pre-commit-hooks.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@
4949
entry: quay.io/helmpack/chart-testing:v3.8.0 sh -c 'export HOME=/tmp; git config --global --add safe.directory /src; ct lint'
5050
files: ^charts/
5151
pass_filenames: false
52+
53+
- id: tf-lock
54+
name: Update TF lock files
55+
description: This hook runs "tofu providers lock -platform=linux_amd64" for any update .terraform.lock.hcl files to support CI
56+
entry: bin/tf-lock.sh
57+
language: script
58+
files: .terraform.lock.hcl$

bin/tf-lock.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# LICENSE: The MIT License Copyright (c) 2025 Volt Grid Pty Ltd t/a Panubo
4+
5+
# Runs Terraform Lint
6+
7+
set -e
8+
9+
if ! command -v tofu >/dev/null 2>&1; then
10+
echo "Error: tofu not found"
11+
exit 1
12+
fi
13+
14+
echo "Running $(basename "${0}") pre-commit checks..."
15+
for FILE in "${@}"; do
16+
pushd "$(basedir "${FILE}")"
17+
tofu providers lock -platform=linux_amd64
18+
popd
19+
done

0 commit comments

Comments
 (0)