Validate/format Tofu code #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.8.7 | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Checks | |
run: | | |
set -eu | |
for d in admin-role capa-controller-role; do ( | |
cd "${d}" | |
echo "Initializing Tofu for ${n}" | |
tofu init | |
echo "Validating Tofu code for ${n}" | |
tofu validate -no-color | |
echo "Formatting Tofu code for ${n}" | |
tofu fmt | |
echo "Checking differences in Tofu code formatting for ${n}" | |
git diff --exit-code || { >&2 echo "Tofu code isn't formatted, please run 'tofu fmt'"; exit 1; } | |
); done |