Skip to content

refactor(terraform): return a struct from module resolvers - #11049

Open
nikpivkin wants to merge 2 commits into
aquasecurity:mainfrom
nikpivkin:refactor/terraform-module-resolver-result
Open

refactor(terraform): return a struct from module resolvers#11049
nikpivkin wants to merge 2 commits into
aquasecurity:mainfrom
nikpivkin:refactor/terraform-module-resolver-result

Conversation

@nikpivkin

@nikpivkin nikpivkin commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

ModuleResolver returned five values: fs.FS, source prefix, module directory, an applies flag and an error. The first three are one result that always travels together, and applies duplicated the error — resolveModule did not read it when err != nil.

Resolvers now return (resolvers.Result, error). An unhandled source is reported as resolvers.ErrNotApplicable; the chain skips it and propagates any other error.

The interface and the chain move from parser to resolvers, which they already depended on entirely. The entry point is resolvers.Resolve.

This also fixes a case in registryResolver: it ignored applies from its nested Remote.Resolve call, so a location Remote does not handle, for example an http:// URL, produced a nil fs.FS with no error, and the parser then failed on it. The chain now reports that the module could not be resolved.

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@nikpivkin nikpivkin added scan/misconfiguration Issues relating to misconfiguration scanning autoready Automatically mark PR as ready for review when all checks pass labels Aug 6, 2026
@github-actions
github-actions Bot marked this pull request as ready for review August 6, 2026 06:08
@github-actions github-actions Bot removed the autoready Automatically mark PR as ready for review when all checks pass label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scan/misconfiguration Issues relating to misconfiguration scanning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant