core: ProviderConfigTransformer properly locates parent module
Due to a logic error here we were trying to find our our module's parent as a descendent of itself, rather than as a descendent of the root. It turns out that we can do this even more simply by just accessing the Parent field on the given config, avoiding the need to traverse the tree down from the root at all. While here, this also switches to using the path.Call helper method rather than manually slicing the path array, since this better communicates our intent.
This commit is contained in:
parent
b9c4780f07
commit
b0435cd533
|
@ -510,12 +510,13 @@ func (t *ProviderConfigTransformer) addProxyProviders(g *Graph, c *configs.Confi
|
|||
return nil
|
||||
}
|
||||
|
||||
parentPath, callName := path[:len(path)-1], path[len(path)-1]
|
||||
parent := c.Descendent(parentPath)
|
||||
parentPath, callAddr := path.Call()
|
||||
parent := c.Parent
|
||||
if parent == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
callName := callAddr.Name
|
||||
var parentCfg *configs.ModuleCall
|
||||
for name, mod := range parent.Module.ModuleCalls {
|
||||
if name == callName {
|
||||
|
|
Loading…
Reference in New Issue