Skip to content

Version 3.2.474 is scanning not related files #7321

@achille1789

Description

@achille1789

Describe the issue
In version v3.2.473, Checkov only scanned Terraform files that were explicitly imported in main.tf (or by the required resources) using the "source" attribute. However, in the latest version, Checkov is now scanning all Terraform files it finds in the directory, even those that are not directly referenced.

Examples
Let’s say I have the following setup:

  • An external package containing default templates for various AWS resources (e.g., S3, API Gateway, DynamoDB, ECS, AppSync, etc.).
  • A Terraform app that only needs to create an ECS resource.
  • My main.tf looks like this:
module "my_ecs" {
  source = "../../path_to_my_external_package/ecs/resource"

  ...
}

Previously, Checkov would only scan the ECS module specified in main.tf. Now, it also scans unrelated modules like S3, API Gateway, etc., from the external package, even though they are not referenced or required, resulting in unexpected errors.

Version (please complete the following information):

  • Checkov Version 3.2.474

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    checksCheck additions or changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions