-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(misconf): export raw Terraform data to Rego #8741
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
Conversation
@simar7 This is a POC of an idea that has been discussed here. What can be improved:
Related: |
Signed-off-by: nikpivkin <[email protected]>
e.logger.Debug("Scan raw Terraform data") | ||
results2, err := e.regoScanner.ScanInput(ctx, types.SourceTerraform, rego.Input{ | ||
Contents: terraform.ExportModules(modules), | ||
Path: basePath, | ||
}) | ||
if err != nil { | ||
e.logger.Error("Failed to scan raw Terraform data", | ||
log.FilePath(basePath), log.Err(err)) | ||
} else { | ||
results = append(results, results2...) | ||
} | ||
|
||
e.logger.Debug("Finished applying checks") |
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.
Can we somehow put this behind a flag? Doing this each time even when raw terraform is not needed might be a bit wasteful and may impact performance.
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.
Done abe2422
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
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.
lgtm, left a couple of comments.
Signed-off-by: nikpivkin <[email protected]>
Description
Related issues
Usage examples
Example config:
Output:
Checks:
required_tags.rego
ephemeral_data_sources.rego
write_only_arguments.rego
Checklist