Merge pull request #1922 from hashicorp/b-orphans-in-module-unflattenable

core: make orphans flattenable
This commit is contained in:
Mitchell Hashimoto 2015-05-12 09:34:37 -07:00
commit 251f7919b3
1 changed files with 23 additions and 0 deletions

View File

@ -176,6 +176,13 @@ func (n *graphNodeOrphanResource) DependentOn() []string {
return n.dependentOn
}
func (n *graphNodeOrphanResource) Flatten(p []string) (dag.Vertex, error) {
return &graphNodeOrphanResourceFlat{
graphNodeOrphanResource: n,
PathValue: p,
}, nil
}
func (n *graphNodeOrphanResource) Name() string {
return fmt.Sprintf("%s (orphan)", n.ResourceName)
}
@ -290,3 +297,19 @@ func (n *graphNodeOrphanResource) EvalTree() EvalNode {
func (n *graphNodeOrphanResource) dependableName() string {
return n.ResourceName
}
// Same as graphNodeOrphanResource, but for flattening
type graphNodeOrphanResourceFlat struct {
*graphNodeOrphanResource
PathValue []string
}
func (n *graphNodeOrphanResourceFlat) Name() string {
return fmt.Sprintf(
"%s.%s", modulePrefixStr(n.PathValue), n.graphNodeOrphanResource.Name())
}
func (n *graphNodeOrphanResourceFlat) Path() []string {
return n.PathValue
}