terraform: Handle missing source in nodeInstallModule

pull/38643/head
Daniel Banck 3 weeks ago committed by Daniel Banck
parent d8aedeaf4a
commit a22d91b65b

@ -73,6 +73,12 @@ func (n *nodeInstallModule) References() []*addrs.Reference {
func (n *nodeInstallModule) Execute(ctx EvalContext, walkOp walkOperation) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics
if n.ModuleCall.SourceExpr == nil {
// Cannot install a module without a source
// Outer diags should already contain a parsing error
return diags
}
var version configs.VersionConstraint
hasVersion := false
if n.ModuleCall.VersionExpr != nil {
@ -141,6 +147,12 @@ func (n *nodeInstallModule) DynamicExpand(ctx EvalContext) (*Graph, tfdiags.Diag
var g Graph
var diags tfdiags.Diagnostics
if n.Config == nil {
// Cannot expand without a config. This can happen when something goes wrong
// during module installation/Execute() above.
return nil, diags
}
expander := ctx.InstanceExpander()
_, call := n.Addr.Call()
expander.SetModuleSingle(n.Path(), call)

Loading…
Cancel
Save