Scanning Terraform code for github repository config
Tell us what happened, what went wrong, and what you expected to happen.
The scan completed with a violation reported for AC_GITHUB_0002 (private repo). As the repo is intentionally public then I added a skip marker for the repository resource: #ts:skip=AC_GITHUB_0002 repo is intentionally public. On re-scanning the violation is reported, but it's also reported as skipped as intended. But the exit status is non-zero. This is causing CI builds to fail when the code passes all applicable policies
What I Did
$ docker run --rm -it -v "$(pwd):/iac:Z" -w /iac accurics/terrascan scan -i terraform
Violation Details -
Description : Repository is Not Private.
File : github.tf
Module Name : root
Plan Root : ./
Line : 21
Severity : MEDIUM
-----------------------------------------------------------------------
Skipped Violations -
Description : Repository is Not Private.
File : github.tf
Module Name : root
Plan Root : ./
Line : 21
Severity : MEDIUM
Skip Comment : repo is intentionally public
-----------------------------------------------------------------------
Scan Summary -
File/Folder : /iac
IaC Type : terraform
Scanned At : 2021-11-26 22:30:19.685939572 +0000 UTC
Policies Validated : 2
Violated Policies : 1
Low : 0
Medium : 1
High : 0
$ echo $?
5
Interestingly, even in the case where the code conforms (with no policies skipped), the exit code is still non-zero:
$ docker run --rm -it -v "$(pwd):/iac:Z" -w /iac accurics/terrascan scan -i terraform
Scan Summary -
File/Folder : /iac
IaC Type : terraform
Scanned At : 2021-11-26 22:34:54.695278246 +0000 UTC
Policies Validated : 2
Violated Policies : 0
Low : 0
Medium : 0
High : 0
$ echo $?
4
Description
Describe what you were trying to get done.
Scanning Terraform code for github repository config
Tell us what happened, what went wrong, and what you expected to happen.
The scan completed with a violation reported for
AC_GITHUB_0002
(private repo). As the repo is intentionally public then I added a skip marker for the repository resource:#ts:skip=AC_GITHUB_0002 repo is intentionally public
. On re-scanning the violation is reported, but it's also reported as skipped as intended. But the exit status is non-zero. This is causing CI builds to fail when the code passes all applicable policiesWhat I Did
Interestingly, even in the case where the code conforms (with no policies skipped), the exit code is still non-zero: