wip fix(terraform): evaluate inline checks for looped modules#6793
Closed
Alex-Waring wants to merge 4 commits intobridgecrewio:mainfrom
Closed
wip fix(terraform): evaluate inline checks for looped modules#6793Alex-Waring wants to merge 4 commits intobridgecrewio:mainfrom
Alex-Waring wants to merge 4 commits intobridgecrewio:mainfrom
Conversation
|
Hi 👋 @Alex-Waring , do you have any workaround while we are waiting for your PR to be merged? |
Contributor
Author
|
Hi @cristian-rincon, no there's no workaround. This is only WIP because it's just a partial fix, I can always come back if this gets merged. If you have any way of getting this looked at feel free, it passes all tests so can be merged |
|
can this be merged? it is really a big blocker |
Contributor
|
Hey @Alex-Waring, |
Contributor
Author
|
Hi @MaryArmaly , this PR needs a fair amount of work to fix and I do not have the capacity to do so at the moment. If someone from PaloAlto wants to pick this up they are welcome to. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
User description
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
The inline comment checker for enriched plan checking, currently works by looking up exceptions using the name of the module, in form
module.module_name, even when there is a count or for_each set on the resource.When we then loop through the resources in the plan to look up their enrichments, this lookup fails as we're using
module.module_name[index]. This PR proves that this is the case by introducing a new test that fails, and then fixes that test.Fixes #6113
Checklist:
Generated description
Dear maintainer, below is a concise technical summary of the changes proposed in this PR:
Fix the inline comment checker for enriched plan checking by addressing the issue with module name lookups when using
countorfor_eachin Terraform modules. TheReportclass incheckov/common/output/report.pyis updated to correctly handle module paths by ignoring indices in module names. New tests are added intest_runner_registry_plan_enrichment.pyto validate the fix, ensuring that checks are correctly skipped for looped modules. The test setup includes Terraform configuration files and a plan JSON file to simulate the scenario.countorfor_eachin Terraform modules.Modified files (1)
Latest Contributors(2)
Modified files (4)
Latest Contributors(2)