Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/opentofu-validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export IAC_BIN=tofu

$IAC_BIN version

for WORKSPACE in $(find . -name 'tf.sh' -print0 | xargs -0 -I{} dirname {} | sort -u); do
pushd "$WORKSPACE"
bash -e tf.sh validate
popd
for WORKSPACE in $(find . \( -name '*.tf' -o -name '*.otf' \) -print0 | xargs -0 -I{} dirname {} | sort -u); do
bash -e tf.sh "$WORKSPACE" validate
done
6 changes: 2 additions & 4 deletions .github/terraform-validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export IAC_BIN=terraform

$IAC_BIN version

for WORKSPACE in $(find . -name 'tf.sh' -print0 | xargs -0 -I{} dirname {} | sort -u); do
pushd "$WORKSPACE"
bash -e tf.sh validate
popd
for WORKSPACE in $(find . -name '*.tf' -print0 | xargs -0 -I{} dirname {} | sort -u); do
bash -e tf.sh "$WORKSPACE" validate
done
1 change: 1 addition & 0 deletions .github/workflows/opentofu-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ on:
- .github/workflows/opentofu-checks.yml
- '**.otf'
- '**.tf'
- tf.sh
1 change: 1 addition & 0 deletions .github/workflows/terraform-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ on:
- .github/terraform-fmt.sh
- .github/workflows/terraform-checks.yml
- '**.tf'
- tf.sh
14 changes: 13 additions & 1 deletion github/johnko/tf.sh → tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ if [[ -z $IAC_BIN ]]; then
export IAC_BIN=terraform
fi

ACTION="$1"
WORKSPACE="$1"
if [[ -z $WORKSPACE ]]; then
echo "ERROR: missing 'WORKSPACE' as 1st argument"
exit 1
fi
if [[ ! -d $WORKSPACE ]]; then
echo "ERROR: invalid 'WORKSPACE', received '$WORKSPACE'"
exit 1
fi
pushd "$WORKSPACE"

ACTION="$2"
if [[ -z $ACTION ]]; then
echo "ERROR: missing 'ACTION' as 1st argument"
exit 1
Expand Down Expand Up @@ -60,3 +71,4 @@ if [[ "APPLY" == "$SAFE_ACTION" || "AUTO" == "$SAFE_ACTION" ]]; then
exit $TF_APPLY_EXIT_CODE
fi
set -e
popd