From ff488648fbba88b83936e305a8551fb75b92d731 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:45:34 +0100 Subject: [PATCH 1/4] ci: add TFLint and Checkov static analysis --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++-- .tflint.hcl | 4 ++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .tflint.hcl diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cba0387..64399ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,6 @@ on: # every commit pushed to main can complete its validation. concurrency: group: ${{ github.workflow }}-${{ github.ref }} - # Only cancel superseded pull request runs. cancel-in-progress: ${{ github.event_name == 'pull_request' }} # CI only needs to read repository contents. @@ -67,4 +66,36 @@ jobs: working-directory: environments/test/frontend run: | tofu init -backend=false -input=false -lockfile=readonly - tofu validate -no-color \ No newline at end of file + tofu validate -no-color + + # Install a pinned TFLint version for static code analysis. + - name: Setup TFLint + uses: terraform-linters/setup-tflint@v6 + with: + tflint_version: v0.64.0 + + # Inspect all OpenTofu root modules and reusable modules. + # Use the shared configuration from the repository root. + - name: Run TFLint + run: | + tflint --init --config="$GITHUB_WORKSPACE/.tflint.hcl" + tflint --recursive --config="$GITHUB_WORKSPACE/.tflint.hcl" --format=compact + + # Checkov requires Python; use a supported version. + - name: Setup Python + uses: actions/setup-python@v7 + with: + python-version: "3.12" + + # Install a pinned version of Checkov. + - name: Install Checkov + run: python -m pip install "checkov==3.4.0" + + # Scan infrastructure and GitHub Actions workflows for security issues. + - name: Run Checkov + run: | + checkov --directory . \ + --framework terraform,github_actions \ + --skip-path '\.terraform/' \ + --quiet + diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..39ec52b --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1,4 @@ +plugin "terraform" { + enabled = true + preset = "recommended" +} \ No newline at end of file From 44775e1b1199ec624212b04a0f1af9352d13731a Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:50:59 +0100 Subject: [PATCH 2/4] fix(ci): use compatible setup-python action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64399ef..0a3d701 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: # Checkov requires Python; use a supported version. - name: Setup Python - uses: actions/setup-python@v7 + uses: actions/setup-python@v5 with: python-version: "3.12" From f7dd2172a7294f0a85012fe8d583166afb19c5ad Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:54:37 +0100 Subject: [PATCH 3/4] fix(modules): declare required OpenTofu version --- modules/network/providers.tf | 2 ++ modules/vm/providers.tf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/network/providers.tf b/modules/network/providers.tf index 3a3b91e..8cc1f00 100644 --- a/modules/network/providers.tf +++ b/modules/network/providers.tf @@ -1,4 +1,6 @@ terraform { + required_version = ">= 1.12.0" + required_providers { openstack = { source = "terraform-provider-openstack/openstack" diff --git a/modules/vm/providers.tf b/modules/vm/providers.tf index 0b0afd6..651fb40 100644 --- a/modules/vm/providers.tf +++ b/modules/vm/providers.tf @@ -1,4 +1,6 @@ terraform { + required_version = ">= 1.12.0" + required_providers { openstack = { source = "terraform-provider-openstack/openstack" From 8ddf067bb074f5cf8ff78d05d1cfd619ec263a46 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 03:05:26 +0100 Subject: [PATCH 4/4] fix(ci): use system Python for Checkov install --- .github/workflows/ci.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a3d701..3211b33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,20 +81,17 @@ jobs: tflint --init --config="$GITHUB_WORKSPACE/.tflint.hcl" tflint --recursive --config="$GITHUB_WORKSPACE/.tflint.hcl" --format=compact - # Checkov requires Python; use a supported version. - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - # Install a pinned version of Checkov. + # Install Checkov in an isolated Python environment. - name: Install Checkov - run: python -m pip install "checkov==3.4.0" + run: | + python3 -m venv "$RUNNER_TEMP/checkov-venv" + "$RUNNER_TEMP/checkov-venv/bin/python" -m pip install "checkov==3.4.0" - # Scan infrastructure and GitHub Actions workflows for security issues. + # Scan OpenTofu configurations and GitHub Actions workflows. - name: Run Checkov run: | - checkov --directory . \ + "$RUNNER_TEMP/checkov-venv/bin/checkov" \ + --directory . \ --framework terraform,github_actions \ --skip-path '\.terraform/' \ --quiet