Fix missing module source panic ()

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh 2024-08-05 12:12:32 -04:00 committed by GitHub
parent 762eac259b
commit 6f01428333
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@ ENHANCEMENTS:
BUG FIXES:
* Ensure that using a sensitive path for templatefile that it doesn't panic([#1801](https://github.com/opentofu/opentofu/issues/1801))
* Fixed crash when module source is not present ([#1888](https://github.com/opentofu/opentofu/pull/1888))
## Previous Releases

View File

@ -138,12 +138,15 @@ func buildChildModules(parent *Config, walker ModuleWalker) (map[string]*Config,
Name: call.Name,
Path: path,
SourceAddr: call.SourceAddr,
SourceAddrRange: call.Source.Range(),
VersionConstraint: call.Version,
Parent: parent,
CallRange: call.DeclRange,
Call: NewStaticModuleCall(path, call.Variables, parent.Root.Module.SourceDir, call.Workspace),
}
if call.Source != nil {
// Invalid modules sometimes have a nil source field which is handled through loadModule below
req.SourceAddrRange = call.Source.Range()
}
child, modDiags := loadModule(parent.Root, &req, walker)
diags = append(diags, modDiags...)
if child == nil {