core: flatten orphan modules
This commit is contained in:
parent
75f000e0cc
commit
a5e4e3de59
|
@ -1,6 +1,7 @@
|
|||
package terraform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
|
@ -59,3 +60,26 @@ func (n *GraphNodeBasicSubgraph) Name() string {
|
|||
func (n *GraphNodeBasicSubgraph) Subgraph() *Graph {
|
||||
return n.Graph
|
||||
}
|
||||
|
||||
func (n *GraphNodeBasicSubgraph) Flatten(p []string) (dag.Vertex, error) {
|
||||
return &graphNodeBasicSubgraphFlat{
|
||||
GraphNodeBasicSubgraph: n,
|
||||
PathValue: p,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Same as GraphNodeBasicSubgraph, but for flattening
|
||||
type graphNodeBasicSubgraphFlat struct {
|
||||
*GraphNodeBasicSubgraph
|
||||
|
||||
PathValue []string
|
||||
}
|
||||
|
||||
func (n *graphNodeBasicSubgraphFlat) Name() string {
|
||||
return fmt.Sprintf(
|
||||
"%s.%s", modulePrefixStr(n.PathValue), n.GraphNodeBasicSubgraph.Name())
|
||||
}
|
||||
|
||||
func (n *graphNodeBasicSubgraphFlat) Path() []string {
|
||||
return n.PathValue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue