Skip to content

Commit 825a8f5

Browse files
CCM-8478 TFSecHardFail
1 parent dd543a7 commit 825a8f5

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

.github/actions/tfsec/action.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ 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+
components_exit_code=0
10+
modules_exit_code=0
11+
12+
./scripts/terraform/tfsec.sh ./infrastructure/terraform/components || components_exit_code=$?
13+
./scripts/terraform/tfsec.sh ./infrastructure/terraform/modules || modules_exit_code=$?
14+
15+
if [ $components_exit_code -ne 0 ] || [ $modules_exit_code -ne 0 ]; then
16+
echo "One or more TFSec scans failed."
17+
exit 1
18+
fi

scripts/terraform/terraform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ terraform-sec: # TFSEC check against Terraform files - optional: terraform_dir|d
6161
--exclude-downloaded-modules \
6262
--tfvars-file infrastructure/terraform/etc/global.tfvars \
6363
--tfvars-file infrastructure/terraform/etc/env_eu-west-2_main.tfvars \
64-
--config-file scripts/config/tfsec.yml
64+
--config-file scripts/config/tfsec.yaml
6565

6666
# ==============================================================================
6767
# Module tests and examples - 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)