Skip to content

Commit

Permalink
Extend earlydecoder to decode module calls (#106)
Browse files Browse the repository at this point in the history
* Add modules to the earlydecoder schema

This will allow decoding modules blocks and their source and
version attributes

* Decode module blocks as part of loadModuleFromFile

* Expose moduleCalls as part of module.Meta

This adds moduleCalls as a new field to Meta and extends the
decoder to return the decoded module calls.
  • Loading branch information
dbanck authored May 3, 2022
1 parent a4eae3f commit 49d5d60
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 40 deletions.
6 changes: 6 additions & 0 deletions earlydecoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ func LoadModule(path string, files map[string]*hcl.File) (*module.Meta, hcl.Diag
outputs[key] = *output
}

modulesCalls := make(map[string]module.ModuleCall)
for key, moduleCall := range mod.ModuleCalls {
modulesCalls[key] = *moduleCall
}

return &module.Meta{
Path: path,
Backend: backend,
Expand All @@ -172,5 +177,6 @@ func LoadModule(path string, files map[string]*hcl.File) (*module.Meta, hcl.Diag
Variables: variables,
Outputs: outputs,
Filenames: filenames,
ModuleCalls: modulesCalls,
}, diags
}
Loading

0 comments on commit 49d5d60

Please sign in to comment.