Skip to content

Commit

Permalink
feat: add tfsec support (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
zahorniak authored Oct 26, 2022
1 parent b054f71 commit 0b21bc1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions pre-commit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The `clowdhaus/terraform-composite-actions/pre-commit` action will install the f
- [tflint](https://github.com/terraform-linters/tflint)
- [terraform-docs](https://github.com/terraform-docs/terraform-docs) using provided `terraform-docs-version` input
- [hcledit](https://github.com/minamijoyo/hcledit) when `install-hcledit` is `true` (and `hcledit-version` to support)
- [tfsec](https://github.com/aquasecurity/tfsec)

```yml
jobs:
Expand Down
14 changes: 14 additions & 0 deletions pre-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ inputs:
description: Version of hcledit to install when `install-hcledit` is true
required: false
default: 0.2.3
install-tfsec:
description: Install tfsec for pre-commit
required: false
default: 'false'
tfsec-version:
description: Version of tfsec to install when `install-tfsec` is true
required: false
default: 1.28.0

runs:
using: composite
Expand Down Expand Up @@ -58,6 +66,12 @@ runs:
rm hcledit.tar.gz 2> /dev/null
fi
if [[ "${{ inputs.install-tfsec }}" == "true" ]]; then
curl -sSLo ./tfsec.tar.gz https://github.com/aquasecurity/tfsec/releases/download/v${{ inputs.tfsec-version }}/tfsec_${{ inputs.tfsec-version }}_$(uname)_amd64.tar.gz
sudo tar -xzf tfsec.tar.gz -C /usr/bin/ tfsec tfsec-checkgen
rm tfsec.tar.gz 2> /dev/null
fi
- name: Execute pre-commit
shell: bash
run: pre-commit run ${{ inputs.args }}

0 comments on commit 0b21bc1

Please sign in to comment.