From 2c191534284929cd285f679b24ae3b2fb8951f19 Mon Sep 17 00:00:00 2001 From: Andreas Sommer Date: Wed, 18 Dec 2024 16:27:04 +0100 Subject: [PATCH] Validate/format Tofu code --- .github/workflows/tofu-checks.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/tofu-checks.yaml diff --git a/.github/workflows/tofu-checks.yaml b/.github/workflows/tofu-checks.yaml new file mode 100644 index 0000000..01ea7c5 --- /dev/null +++ b/.github/workflows/tofu-checks.yaml @@ -0,0 +1,29 @@ +name: OpenTofu checks +on: + push: + +jobs: + tofu_checks: + name: OpenTofu checks + runs-on: ubuntu-24.04 + steps: + - uses: opentofu/setup-opentofu@592200bd4b9bbf4772ace78f887668b1aee8f716 # v1.0.5 + with: + tofu_version: 1.9.0-rc1 + + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Checks + run: | + set -eu + + for d in admin-role capa-controller-role; do ( + cd "${d}" + + tofu validate -no-color + + echo "Formatting Tofu code" + tofu fmt + echo "Checking differences in Tofu code formatting" + git diff --exit-code || { >&2 echo "Tofu code isn't formatted, please run 'tofu fmt'"; exit 1; } + ); done