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): support resource_type attribute #6872

Merged
merged 11 commits into from
Nov 26, 2024

Conversation

SteveVaknin
Copy link
Contributor

@SteveVaknin SteveVaknin commented Nov 25, 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

  • support resource_type attribute in terraform graph scanning.
    For example:
resource "azurerm_security_center_subscription_pricing" "example" {
  tier = "free"
  resource_type = "VirtualMachines"
  extension {
    name = "ContainerRegistriesVulnerabilityAssessments"
  }
}

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

Below is a concise technical summary of the changes proposed in this PR:

Introduce support for the resource_type attribute in Terraform graph scanning by modifying the BaseAttributeSolver and Module classes. The BaseAttributeSolver now wraps reserved attributes to ensure they are scanned correctly. The Module class alters reserved attributes to include resource_type in the scanning process. Additionally, a new test case in test_module.py verifies the correct handling of the resource_type attribute.

TopicDetails
Testing Enhancements Verify the handling of the resource_type attribute in Terraform modules.
Modified files (1)
  • tests/terraform/parser/test_module.py
Latest Contributors(2)
UserCommitDate
SteveVakninfeat-terraform-support...November 14, 2024
bo156feat-terraform-Remove-...August 16, 2023
Resource Type Support Support the resource_type attribute in Terraform graph scanning.
Modified files (3)
  • checkov/terraform/graph_builder/graph_components/module.py
  • checkov/common/graph/graph_builder/graph_components/attribute_names.py
  • checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py
Latest Contributors(2)
UserCommitDate
SteveVakninfeat-terraform-support...November 14, 2024
lirshindalmanfeat-general-filter-re...July 25, 2024
This pull request is reviewed by Baz. Join @SteveVaknin and the rest of your team on (Baz).

@SteveVaknin SteveVaknin changed the title Fix/steve/resource type feat(terraform): support resource_type attribute Nov 25, 2024
@SteveVaknin SteveVaknin merged commit 7298362 into main Nov 26, 2024
42 checks passed
@SteveVaknin SteveVaknin deleted the fix/steve/resource_type branch November 26, 2024 11:42
Saarett pushed a commit that referenced this pull request Nov 26, 2024
* feature(terraform): support resource_type attribute

* fix lint issues

* add missing type

* move to func

* move comment

* fix lint
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