Merge pull request #1934 from hashicorp/b-flatten-orphan-outputs
core: flatten orphan outputs
This commit is contained in:
commit
bb3ed8d740
|
@ -2,6 +2,8 @@ package terraform
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
)
|
||||
|
||||
// GraphNodeOutput is an interface that nodes that are outputs must
|
||||
|
@ -66,3 +68,31 @@ func (n *graphNodeOrphanOutput) EvalTree() EvalNode {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GraphNodeFlattenable impl.
|
||||
func (n *graphNodeOrphanOutput) Flatten(p []string) (dag.Vertex, error) {
|
||||
return &graphNodeOrphanOutputFlat{
|
||||
graphNodeOrphanOutput: n,
|
||||
PathValue: p,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type graphNodeOrphanOutputFlat struct {
|
||||
*graphNodeOrphanOutput
|
||||
|
||||
PathValue []string
|
||||
}
|
||||
|
||||
func (n *graphNodeOrphanOutputFlat) Name() string {
|
||||
return fmt.Sprintf(
|
||||
"%s.%s", modulePrefixStr(n.PathValue), n.graphNodeOrphanOutput.Name())
|
||||
}
|
||||
|
||||
func (n *graphNodeOrphanOutputFlat) EvalTree() EvalNode {
|
||||
return &EvalOpFilter{
|
||||
Ops: []walkOperation{walkApply, walkRefresh},
|
||||
Node: &EvalDeleteOutput{
|
||||
Name: n.OutputName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue