Skip to content

Commit f971b0d

Browse files
Fix TFSec CI step
1 parent 28d0a11 commit f971b0d

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

.github/actions/tfsec/action.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ runs:
66
- name: "TFSec Scan - Components"
77
shell: bash
88
run: |
9-
for component in $(find infrastructure/terraform/components -mindepth 1 -type d); do
10-
scripts/terraform/tfsec.sh $component
11-
done
12-
- name: "TFSec Scan - Modules"
13-
shell: bash
14-
run: |
15-
for module in $(find infrastructure/terraform/modules -mindepth 1 -type d); do
16-
scripts/terraform/tfsec.sh $module
17-
done
9+
modules_exit_code=0
10+
11+
./scripts/terraform/tfsec.sh ./infrastructure/modules || modules_exit_code=$?
12+
13+
if [ $modules_exit_code -ne 0 ]; then
14+
echo "One or more TFSec scans failed."
15+
exit 1
16+
fi

scripts/terraform/terraform.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ terraform-shellscript-lint: # Lint all Terraform module shell scripts @Quality
2525
done
2626

2727
terraform-sec: # TFSEC check against Terraform files - optional: terraform_dir|dir=[path to a directory where the command will be executed, relative to the project's top-level directory, default is one of the module variables or the example directory, if not set], terraform_opts|opts=[options to pass to the Terraform fmt command, default is '-recursive'] @Quality
28-
tfsec infrastructure/terraform \
28+
tfsec infrastructure/modules \
2929
--force-all-dirs \
3030
--exclude-downloaded-modules \
31-
--config-file scripts/config/tfsec.yml
31+
--config-file scripts/config/tfsec.yaml
3232

3333
# ==============================================================================
3434
# Configuration - please DO NOT edit this section!

scripts/terraform/tfsec.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ function run-tfsec-natively() {
3737

3838
echo "Running TFSec on directory: $dir_to_scan"
3939
tfsec \
40-
--concise-output \
4140
--force-all-dirs \
4241
--exclude-downloaded-modules \
4342
--config-file scripts/config/tfsec.yaml \
4443
--format text \
45-
--soft-fail \
4644
"$dir_to_scan"
4745

4846
check-tfsec-status

0 commit comments

Comments
 (0)