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 in variable rendering #4296

Merged
merged 10 commits into from Jan 22, 2023
Merged

Conversation

YaaraVerner
Copy link
Contributor

@YaaraVerner YaaraVerner commented Jan 22, 2023

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

Description

create a function for conditional expression division instead of regex to catch more edge cases (such as dictionary as value).
fix in evaluate_conditional_expression - do not choose the first value if we didn't succeed to evaluate expression.
fix in evaluate_map - do not replace '=' if it is '==' or '!='

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

@YaaraVerner YaaraVerner changed the title Fix in variable rendering fix(terraform): fix in conditional expression variable rendering Jan 22, 2023
@YaaraVerner YaaraVerner marked this pull request as ready for review January 22, 2023 13:33
Copy link
Contributor

@ChanochShayner ChanochShayner left a comment

Choose a reason for hiding this comment

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

💯

@YaaraVerner YaaraVerner changed the title fix(terraform): fix in conditional expression variable rendering fix(terraform): fix in variable rendering Jan 22, 2023
@YaaraVerner YaaraVerner merged commit 2415f20 into main Jan 22, 2023
@YaaraVerner YaaraVerner deleted the fix-in-variable-rendering branch January 22, 2023 15:00
reemodo pushed a commit to reemodo/checkov that referenced this pull request Jan 22, 2023
* add new find_conditional_expression_groups function

* update find_conditional_expression_groups to search also in the middle of the expression

* fixes and add test_dynamic_with_conditional_expression

* fix edge case

* fix in evaluate_map

* fix

* fixes
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.

None yet

3 participants