-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to extract rules to skip from terraform comments #434
Conversation
Codecov Report
@@ Coverage Diff @@
## master #434 +/- ##
==========================================
+ Coverage 74.46% 74.57% +0.11%
==========================================
Files 87 88 +1
Lines 2005 2014 +9
==========================================
+ Hits 1493 1502 +9
Misses 379 379
Partials 133 133
|
|
||
"github.com/accurics/terrascan/pkg/iac-providers/output" | ||
var ( | ||
skipRulesPattern = regexp.MustCompile(`#ts:skip=\s*(([A-Za-z0-9]+\.?){5})(\s*,\s*([A-Za-z0-9]+\.?){5})*`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, I think the rule ID format may go through some changes prior to the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, kept that in mind!
…urce config comments
c329a3f
to
380e60a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look fine, my only thought is about the skip_rules param when it is null. Shall we mark this in the json as omitempty? It seems like that would simplify some of the test data by not having to include it when null. Also, it prevents an empty field from being printed out in the yaml/json/xml output.
@williepaul, I agree with you and I do not have a problem using |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This PR adds support for extracting rule ids to skip policy evaluation. These rules can be set as a comma separated list of rule ids in the comments of terraform resource config in the following pattern:
#ts:skip=AWS.S3Bucket.DS.High.1041, AWS.S3Bucket.DS.High.1042
Example of a terraform resource config with rules to skip policy evaluation: