-
Notifications
You must be signed in to change notification settings - Fork 3
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 parse Terraform plan and state files #40
Conversation
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.
@Subhajit97 please take a look at the review comments. Thanks!!
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.
@Subhajit97 please take a look at the review comment. Thanks!!
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.
@Subhajit97 @bigdatasourav Please see comments, thanks!
// Check if the file contains TF plan | ||
if pathInfo.IsTFPlanFilePath { | ||
// Initialize the JSON parser | ||
jsonParser := p.Parser{} |
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.
Do we need another parser, or can we add the JSON parser into the combined parser we're using, e.g., https://github.com/Checkmarx/kics/blob/954212dcacad42ff210284d29b39898c56b92814/pkg/scan/scan.go#L224-L236?
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.
@bigdatasourav please take a look at the minor review comments. Thanks!!
config/terraform.spc
Outdated
# Similarly, Plan File Paths is a list of locations to search for Terraform plan files | ||
# Similarly, State File Paths is a list of locations to search for Terraform state files |
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.
# Similarly, Plan File Paths is a list of locations to search for Terraform plan files | |
# Similarly, State File Paths is a list of locations to search for Terraform state files | |
# Plan File Paths is a list of locations to search for Terraform plan files | |
# State File Paths is a list of locations to search for Terraform state files |
docs/index.md
Outdated
@@ -16,6 +16,44 @@ A Terraform configuration file is used to declare resources, variables, modules, | |||
|
|||
[Steampipe](https://steampipe.io) is an open source CLI to instantly query data using SQL. | |||
|
|||
The plugin supports scanning Terraform configuration files from various sources (e.g., [Local files](#configuring-local-file-paths), [Git](#configuring-remote-git-repository-urls), [S3](#configuring-s3-urls) etc.), and [parsing Terraform plans](#scanning-terraform-plan) as well. |
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.
@bigdatasourav could you please update this line to mention the terraform state file as well?
connection "terraform" { | ||
plugin = "terraform" | ||
|
||
configuration_file_paths = ["*.tf"] |
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.
@bigdatasourav can we add the new config arguments as well?
Integration test logs
Logs
Example query results
Results