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

fix(terraform): Fix dynamic blocks nested module #3890

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

ChanochShayner
Copy link
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Fix dynamic blocks nested module, and uncomment the UT.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@@ -379,7 +379,12 @@ def _process_dynamic_blocks(dynamic_blocks: list[dict[str, Any]] | dict[str, Any
except (StopIteration, AttributeError):
continue
block_content[DYNAMIC_STRING][next_key]['for_each'] = dynamic_values
rendered_blocks.update(TerraformVariableRenderer._process_dynamic_blocks(block_content[DYNAMIC_STRING]))

flatten_key = next(iter(rendered_blocks.keys()))
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 🥇

@ChanochShayner ChanochShayner merged commit c36a63e into master Nov 16, 2022
@ChanochShayner ChanochShayner deleted the uncomment-ut-for-nested-dynamic-blocks branch November 16, 2022 09:25
Floodnut pushed a commit to init-cloud/checkov that referenced this pull request Nov 16, 2022
* Fix dynamic blocks nested module

* Update checkov/terraform/graph_builder/variable_rendering/renderer.py

Co-authored-by: Anton Grübel <[email protected]>

* Lint fix

Co-authored-by: Anton Grübel <[email protected]>
@ChanochShayner ChanochShayner self-assigned this Feb 23, 2023
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.

4 participants