Skip to content

Bug: the same Terraform module used at two versions is reported once, at the first version #620

Closed

Description

@vibgrate-team

Context

scanTerraform in src/core-open/scanners/terraform-scanner.ts deduplicates modules by source only and keeps the first version it sees. A repository with envs/staging/main.tf on terraform-aws-modules/vpc/aws 4.0.2 and envs/prod/main.tf on 5.8.1 reports a single row at whichever file was read first, so the older pin can be hidden (or the newer one) and drift is misleading.

What to do

  • Deduplicate modules on source and version.
  • Keep row order deterministic (sort by source, then version).
  • Add unit tests.

Acceptance

  • Two versions of one module produce two module: rows, each with its own drift.
  • The same source and version used twice still produces one row.
  • Row order is stable across runs.

Activity

  1. added
    bug
    on Nov 10, 2026
  2. vibgrate-team commented on Nov 10, 2026

    @vibgrate-team
    ContributorAuthor

    Confirmed: the module pass in scanTerraform keys uniqueModules on m.source alone (around line 245 of src/core-open/scanners/terraform-scanner.ts), so the first file read wins and the other pin disappears.

    Keying on `${m.source}@${m.version ?? ''}` fixes the dedupe, and sorting the final module list by source then version makes the order independent of file-walk order. A fixture with envs/staging/main.tf and envs/prod/main.tf pinning two versions of the same module, plus a duplicate pin, covers all three acceptance points.

  3. added a commit that references this issue on Nov 11, 2026
    147e010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions