Skip to content

Commit

Permalink
Fix tfsec CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
lopopolo committed Oct 19, 2024
1 parent 5d45fa1 commit 3d2b5b9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ jobs:
- name: "Validate github-org-artichoke-ruby environment"
run: terraform -chdir=github-org-artichoke-ruby validate -no-color

- name: "Init and validate github-actions-oidc-provider project"
run: |
terraform -chdir=terraform/projects/github-actions-oidc-provider init
terraform -chdir=terraform/projects/github-actions-oidc-provider validate -no-color
- name: "Init and validate github-actions-terraform-linting project"
run: |
terraform -chdir=terraform/projects/github-actions-terraform-linting init
terraform -chdir=terraform/projects/github-actions-terraform-linting validate -no-color
- name: "Init and validate remote-state project"
run: |
terraform -chdir=terraform/projects/remote-state init
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/tfsec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:
terraform -chdir=github-org-artichoke init
terraform -chdir=github-org-artichokeruby init
terraform -chdir=github-org-artichoke-ruby init
terraform -chdir=remote-state init
terraform -chdir=terraform/projects/github-actions-oidc-provider init
terraform -chdir=terraform/projects/github-actions-terraform-linting init
terraform -chdir=terraform/projects/remote-state init
- name: "tfsec aws"
uses: docker://aquasec/tfsec:latest
Expand Down Expand Up @@ -76,13 +78,29 @@ jobs:
entrypoint: tfsec
args: github-org-artichoke-ruby

- name: "tfsec github-actions-oidc-provider"
uses: docker://aquasec/tfsec:latest
id: tfsec_gha_oidc
continue-on-error: true
with:
entrypoint: tfsec
args: terraform/projects/github-actions-oidc-provider

- name: "tfsec github-actions-terraform-linting"
uses: docker://aquasec/tfsec:latest
id: tfsec_gha_tf_lint
continue-on-error: true
with:
entrypoint: tfsec
args: terraform/projects/github-actions-terraform-linting

- name: "tfsec remote-state"
uses: docker://aquasec/tfsec:latest
id: tfsec_remote_state
continue-on-error: true
with:
entrypoint: tfsec
args: remote-state
args: terraform/projects/remote-state

- name: "Check on failures"
run: |
Expand All @@ -103,9 +121,17 @@ jobs:
failed="y"
echo >&2 "tfsec github-org-artichoke-ruby failed"
fi
if [[ ${{ steps.tfsec_gha_oidc.outcome }} != "success" ]]; then
failed="y"
echo >&2 "tfsec terraform/projects/github-actions-oidc-provider failed"
fi
if [[ ${{ steps.tfsec_gha_tf_lint.outcome }} != "success" ]]; then
failed="y"
echo >&2 "tfsec terraform/projects/github-actions-terraform-linting failed"
fi
if [[ ${{ steps.tfsec_remote_state.outcome }} != "success" ]]; then
failed="y"
echo >&2 "tfsec remote-state failed"
echo >&2 "tfsec terraform/projects/remote-state failed"
fi
if [[ -n "$failed" ]]; then
exit 1
Expand Down

0 comments on commit 3d2b5b9

Please sign in to comment.