stackconfig: Bring the source bundle with the config

When we load stackconfig we don't immediately load any of the modules that
component blocks refer to, so we need to bring the source bundle along
with the configuration so that a downstream piece of code (the stack
language runtime, currently) can load those from the same source bundle.
pull/34738/head
Martin Atkins 3 years ago
parent d3e93e4a31
commit d435cd5a1b

@ -27,6 +27,12 @@ const maxEmbeddedStackNesting = 20
// so on for arbitrary levels of nesting.
type Config struct {
Root *ConfigNode
// Sources is the source bundle that the configuration was loaded from.
//
// This is also the source bundle that any Terraform modules used by
// components should be loaded from.
Sources *sourcebundle.Bundle
}
// ConfigNode represents a node in a tree of stacks that are to be planned and
@ -66,7 +72,8 @@ func LoadConfigDir(sourceAddr sourceaddrs.FinalSource, sources *sourcebundle.Bun
}
ret := &Config{
Root: rootNode,
Root: rootNode,
Sources: sources,
}
// Before we return we need to walk the tree and resolve all of the

@ -198,6 +198,7 @@ func (s *Stack) InputsType(ctx context.Context) (cty.Type, *typeexpr.Defaults) {
atys[vAddr.Name] = cfg.TypeConstraint()
if def := cfg.DefaultValue(ctx); def != cty.NilVal {
defs.DefaultValues[vAddr.Name] = def
opts = append(opts, vAddr.Name)
}
if childDefs := cfg.NestedDefaults(); childDefs != nil {
defs.Children[vAddr.Name] = childDefs

Loading…
Cancel
Save