incorrect early return during module transformer

The recursive call should only return immediately on error.

The switch statement to find the current path should not use
ReferenceOutside, as we are getting the path for configuration, not for
references. This case would not have been taken currently, since all
GraphNodeReferenceOutside are also GraphNodeModulePath.
This commit is contained in:
James Bardin 2020-06-06 21:42:01 -04:00
parent 242a916a17
commit 198c632e04
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@ var (
_ RemovableIfNotTargeted = (*nodeExpandOutput)(nil) _ RemovableIfNotTargeted = (*nodeExpandOutput)(nil)
_ GraphNodeReferenceable = (*nodeExpandOutput)(nil) _ GraphNodeReferenceable = (*nodeExpandOutput)(nil)
_ GraphNodeReferencer = (*nodeExpandOutput)(nil) _ GraphNodeReferencer = (*nodeExpandOutput)(nil)
_ GraphNodeReferenceOutside = (*nodeExpandOutput)(nil)
_ GraphNodeDynamicExpandable = (*nodeExpandOutput)(nil) _ GraphNodeDynamicExpandable = (*nodeExpandOutput)(nil)
_ graphNodeTemporaryValue = (*nodeExpandOutput)(nil) _ graphNodeTemporaryValue = (*nodeExpandOutput)(nil)
_ graphNodeExpandsInstances = (*nodeExpandOutput)(nil) _ graphNodeExpandsInstances = (*nodeExpandOutput)(nil)

View File

@ -120,8 +120,6 @@ func (t *ModuleExpansionTransformer) transform(g *Graph, c *configs.Config, pare
case GraphNodeModulePath: case GraphNodeModulePath:
path = t.ModulePath() path = t.ModulePath()
case GraphNodeReferenceOutside:
path, _ = t.ReferenceOutside()
default: default:
continue continue
} }
@ -134,7 +132,9 @@ func (t *ModuleExpansionTransformer) transform(g *Graph, c *configs.Config, pare
// Also visit child modules, recursively. // Also visit child modules, recursively.
for _, cc := range c.Children { for _, cc := range c.Children {
return t.transform(g, cc, v) if err := t.transform(g, cc, v); err != nil {
return err
}
} }
return nil return nil