Skip to content

New layout

New layout #5

Workflow file for this run

name: 'OpenTofu Plan'
on:
push:
branches: [ "main" ]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tofu:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
strategy:
fail-fast: false
matrix:
type: [plain, istio, cilium]
name: 'Terraform'
runs-on: ubuntu-latest
environment: production
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
- name: Terraform Init
run: cd cluster && tofu init
- name: Terraform Plan (Plain)
if: matrix.type == 'plain'
run: cd cluster && tofu plan -no-color -out=tfplan.out && tofu show -json tfplan.out > tfplan.json
- name: Terraform Plan (With Istio)
if: matrix.type == 'istio'
run: cd cluster && tofu plan -var="enable_istio=true" -no-color -out=tfplan.out && tofu show -json tfplan.out > tfplan.json
- name: Terraform Plan (With Cilium)
if: matrix.type == 'cilium'
run: cd cluster && tofu plan -var="enable_cilium=true" -no-color -out=tfplan.out && tofu show -json tfplan.out > tfplan.json
- name: Output Plan
run: cat cluster/tfplan.json
- name: Checkov Analysis
id: checkov
uses: bridgecrewio/checkov-action@v12
with:
directory: cluster/
file: cluster/tfplan.json
output_format: cli,sarif
output_file_path: console,results.sarif
# Ignoring checks since the original helm charts is so configure
# Reference: https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx
skip_check: CKV_K8S_25,CKV_K8S_22,CKV_K8S_35,CKV_K8S_26,CKV_K8S_11,CKV_K8S_15,CKV_K8S_12
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
# Results are generated only on a success or failure
# this is required since GitHub by default won't run the next step
# when the previous one has failed. Security checks that do not pass will 'fail'.
# An alternative is to add `continue-on-error: true` to the previous step
# Or 'soft_fail: true' to checkov.
if: success() || failure()
with:
sarif_file: results.sarif