Skip to content
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

Merged
merged 18 commits into from
Sep 7, 2023
Merged

Conversation

Subhajit97
Copy link
Contributor

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
Add example SQL query results here (please include the input queries as well)

@Subhajit97 Subhajit97 requested a review from misraved June 16, 2023 15:19
@Subhajit97 Subhajit97 self-assigned this Jun 16, 2023
Copy link
Contributor

@misraved misraved left a 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!!

config/terraform.spc Outdated Show resolved Hide resolved
config/terraform.spc Outdated Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

@misraved misraved left a 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!!

terraform/connection_config.go Show resolved Hide resolved
Copy link
Contributor

@cbruno10 cbruno10 left a 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!

terraform/utils.go Outdated Show resolved Hide resolved
// Check if the file contains TF plan
if pathInfo.IsTFPlanFilePath {
// Initialize the JSON parser
jsonParser := p.Parser{}
Copy link
Contributor

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?

@bigdatasourav bigdatasourav changed the title Add support to parse Terraform plans Add support to parse Terraform plan and state files Aug 31, 2023
Copy link
Contributor

@misraved misraved left a 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!!

Comment on lines 5 to 6
# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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.
Copy link
Contributor

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"]
Copy link
Contributor

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?

@misraved misraved merged commit 595c5c9 into main Sep 7, 2023
1 check passed
@misraved misraved deleted the issue-39 branch September 7, 2023 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for parsing Terraform plans and pull them into existing tables
4 participants