feat: resolve single depth references [CFG-1623] #2791
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces single depth reference resolution in terraform plan parsing. It is the TypeScript equivalent of snyk/snyk-iac-parsers#8. In the future it might be better to use
gopherjs
to include the Terraform Plan parsing in the CLI, like we already do for Terraform Variable Dereferencing. However that requires a bit more work so for now this quick re-implementation of the logic in TypeScript will have to do.Where should the reviewer start?
Review commit by commit:
"service_role": "arn:aws:iam::719261439472:role/terra_ci_job",
for some reason.Note The old CLI was raising a false positive for
logging2
, which is not being raised with this new update.How should this be manually tested?
npm run build
snyk iac test ./test/fixtures/iac/terraform-plan/tf-plan-v4.json
snyk-dev iac test ./test/fixtures/iac/terraform-plan/tf-plan-v4.json
What are the relevant tickets?
https://snyksec.atlassian.net/browse/CFG-1623
Screenshots
before
after
Background context
https://docs.google.com/document/d/1gDFhCNRZSXu2caj7HUQ0GtOajXV34hZkTiU_Fo0FKyo/edit