mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-27 09:21:14 -06:00
e3ea3150ae
The removed output need to be referencable so if its parent module is also being remove, the removal happens in the correct order.
41 lines
825 B
Go
41 lines
825 B
Go
package terraform
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// NodeOutputOrphan represents an output that is an orphan.
|
|
type NodeOutputOrphan struct {
|
|
OutputName string
|
|
PathValue []string
|
|
}
|
|
|
|
func (n *NodeOutputOrphan) Name() string {
|
|
result := fmt.Sprintf("output.%s (orphan)", n.OutputName)
|
|
if len(n.PathValue) > 1 {
|
|
result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result)
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
// GraphNodeReferenceable
|
|
func (n *NodeOutputOrphan) ReferenceableName() []string {
|
|
return []string{"output." + n.OutputName}
|
|
}
|
|
|
|
// GraphNodeSubPath
|
|
func (n *NodeOutputOrphan) Path() []string {
|
|
return n.PathValue
|
|
}
|
|
|
|
// GraphNodeEvalable
|
|
func (n *NodeOutputOrphan) EvalTree() EvalNode {
|
|
return &EvalOpFilter{
|
|
Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
|
|
Node: &EvalDeleteOutput{
|
|
Name: n.OutputName,
|
|
},
|
|
}
|
|
}
|