Skip to content

Commit

Permalink
Create an action for scan infra to make it reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo Macapobre committed Aug 20, 2024
1 parent 47c45b7 commit 38f5382
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/actions/scan-infra/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Scan Infra

inputs:
working_directory:
description: "Folder location where the TF scripts lives"
required: true
environment:
description: "Environment name"
required: true

jobs:
tfsec:
name: Scan Terraform Code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: tfsec
uses: aquasecurity/[email protected]
with:
working_directory: ${{ inputs.working_directory }}
additional_args: "--tfvars-file=${{ inputs.working_directory }}/${{ inputs.environment }}.tfvars"
soft_fail: false
github_token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 4 additions & 13 deletions .github/workflows/aws-template-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,10 @@ jobs:
scan:
name: Scan TF Code
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: tfsec
uses: aquasecurity/[email protected]
with:
working_directory: ${{ inputs.CONTEXT_FOLDER }}
soft_fail: false
uses: ./.github/workflows/actions/scan-infra
with:
working_directory: ${{ inputs.CONTEXT_FOLDER }}
environment: ${{ inputs.ENVIRONMENT_NAME }}
needs: [check_changes]

deploy_infra:
Expand Down

0 comments on commit 38f5382

Please sign in to comment.