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

feat(terraform_plan): Support after_unknown evaluation of complex attributes #6784

Merged
merged 2 commits into from
Oct 20, 2024

Conversation

bo156
Copy link
Contributor

@bo156 bo156 commented Oct 20, 2024

User description

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

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

New/Edited policies (Delete if not relevant)

Description

Include a description of what makes it a violation and any relevant external links.

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:

  • 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

Generated description

Dear maintainer, below is a concise technical summary of the changes proposed in this PR:

Introduce support for evaluating complex attributes with after_unknown values in Terraform plans. The plan_parser.py now includes a new function _handle_complex_after_unknown to manage nested keys with after_unknown values. This change is tested with a new JSON test file tfplan.json and a corresponding test case test_after_unknown_handling in test_plan_parser.py.

TopicDetails
Test Case Addition Add a new test case test_after_unknown_handling to verify the handling of complex after_unknown attributes using a mock environment variable.
Modified files (1)
  • tests/terraform/parser/test_plan_parser.py
Latest Contributors(2)
EmailCommitDate
maxamel2002@gmail.comfeat-terraform_plan-ad...September 04, 2024
28880387+tsmithv11@use...fix-terraform_plan-Fix...July 29, 2024
Test Resource File Include a new test resource file tfplan.json to simulate Terraform plan scenarios with after_unknown attributes.
Modified files (1)
  • tests/terraform/parser/resources/plan_after_unknown/tfplan.json
Latest Contributors(0)
EmailCommitDate
Complex Attribute Handling Enhance the plan_parser.py to handle complex attributes with after_unknown values by introducing _handle_complex_after_unknown.
Modified files (1)
  • checkov/terraform/plan_parser.py
Latest Contributors(2)
EmailCommitDate
maxamel2002@gmail.comfeat-terraform_plan-ad...September 04, 2024
28880387+tsmithv11@use...fix-terraform_plan-Fix...July 29, 2024
This pull request is reviewed by Baz. Join @bo156 and the rest of your team on (Baz).

@pazbechor pazbechor self-requested a review October 20, 2024 14:44
@bo156 bo156 merged commit 20e9faa into main Oct 20, 2024
42 checks passed
@bo156 bo156 deleted the feature/support-complex-after-unknwon branch October 20, 2024 14:47
pull bot pushed a commit to tooniez/checkov that referenced this pull request Oct 20, 2024
…ributes (bridgecrewio#6784)

* Added function to handle complex case of after_unknwon in terraform plan

* Added test
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.

3 participants