mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
40f09027f0
While the Expander itself now handles the recursive expansion of modules, Resources themselves still need to be expanded twice, because the evaluation of the Resource, which entails evaluating the for_each or count expressions, is separate from the ResourceInstance expansion. Add a nodeExpandPlannableResource to do handle this expansion to allow all NodePlannableResources to call EvalWriteResourceState with an absolute address.
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package terraform
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform/addrs"
|
|
)
|
|
|
|
// NodeOutputOrphan represents an output that is an orphan.
|
|
type NodeOutputOrphan struct {
|
|
Addr addrs.AbsOutputValue
|
|
}
|
|
|
|
var (
|
|
_ GraphNodeModuleInstance = (*NodeOutputOrphan)(nil)
|
|
_ GraphNodeReferenceable = (*NodeOutputOrphan)(nil)
|
|
_ GraphNodeReferenceOutside = (*NodeOutputOrphan)(nil)
|
|
_ GraphNodeEvalable = (*NodeOutputOrphan)(nil)
|
|
)
|
|
|
|
func (n *NodeOutputOrphan) Name() string {
|
|
return fmt.Sprintf("%s (orphan)", n.Addr.String())
|
|
}
|
|
|
|
// GraphNodeReferenceOutside implementation
|
|
func (n *NodeOutputOrphan) ReferenceOutside() (selfPath, referencePath addrs.Module) {
|
|
return referenceOutsideForOutput(n.Addr)
|
|
}
|
|
|
|
// GraphNodeReferenceable
|
|
func (n *NodeOutputOrphan) ReferenceableAddrs() []addrs.Referenceable {
|
|
return referenceableAddrsForOutput(n.Addr)
|
|
}
|
|
|
|
// GraphNodeModuleInstance
|
|
func (n *NodeOutputOrphan) Path() addrs.ModuleInstance {
|
|
return n.Addr.Module
|
|
}
|
|
|
|
// GraphNodeModulePath
|
|
func (n *NodeOutputOrphan) ModulePath() addrs.Module {
|
|
return n.Addr.Module.Module()
|
|
}
|
|
|
|
// GraphNodeEvalable
|
|
func (n *NodeOutputOrphan) EvalTree() EvalNode {
|
|
return &EvalOpFilter{
|
|
Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
|
|
Node: &EvalDeleteOutput{
|
|
Addr: n.Addr,
|
|
},
|
|
}
|
|
}
|