NodeDestroyResource needs to be referencable
The change in #23696 removed the NodeAbstractResource methods from the NodeDestroyResource type, in order to prevent other resource behaviors, like requesting a provider. While this node type is not directly referenced, it was implicitly ordered against the module cleanup by virtue of being a resource node. Since there's no good entry point to test this ordering at the moment,
This commit is contained in:
parent
b6a041af2b
commit
a6cdfad590
|
@ -281,6 +281,9 @@ type NodeDestroyResource struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
_ GraphNodeResource = (*NodeDestroyResource)(nil)
|
||||||
|
_ GraphNodeReferenceable = (*NodeDestroyResource)(nil)
|
||||||
|
_ GraphNodeReferencer = (*NodeDestroyResource)(nil)
|
||||||
_ GraphNodeEvalable = (*NodeDestroyResource)(nil)
|
_ GraphNodeEvalable = (*NodeDestroyResource)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -288,6 +291,24 @@ func (n *NodeDestroyResource) Name() string {
|
||||||
return n.NodeAbstractResource.ResourceAddr().String() + " (clean up state)"
|
return n.NodeAbstractResource.ResourceAddr().String() + " (clean up state)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GraphNodeReferenceable, overriding NodeAbstractResource
|
||||||
|
func (n *NodeDestroyResource) ReferenceableAddrs() []addrs.Referenceable {
|
||||||
|
// NodeDestroyResource doesn't participate in references: the graph
|
||||||
|
// builder that created it should ensure directly that it already depends
|
||||||
|
// on every other node related to its resource, without relying on
|
||||||
|
// references.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GraphNodeReferencer, overriding NodeAbstractResource
|
||||||
|
func (n *NodeDestroyResource) References() []*addrs.Reference {
|
||||||
|
// NodeDestroyResource doesn't participate in references: the graph
|
||||||
|
// builder that created it should ensure directly that it already depends
|
||||||
|
// on every other node related to its resource, without relying on
|
||||||
|
// references.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// GraphNodeEvalable
|
// GraphNodeEvalable
|
||||||
func (n *NodeDestroyResource) EvalTree() EvalNode {
|
func (n *NodeDestroyResource) EvalTree() EvalNode {
|
||||||
// This EvalNode will produce an error if the resource isn't already
|
// This EvalNode will produce an error if the resource isn't already
|
||||||
|
@ -298,3 +319,13 @@ func (n *NodeDestroyResource) EvalTree() EvalNode {
|
||||||
Addr: n.NodeAbstractResource.ResourceAddr().Resource,
|
Addr: n.NodeAbstractResource.ResourceAddr().Resource,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GraphNodeResource
|
||||||
|
func (n *NodeDestroyResource) ResourceAddr() addrs.AbsResource {
|
||||||
|
return n.NodeAbstractResource.ResourceAddr()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GraphNodeSubpath
|
||||||
|
func (n *NodeDestroyResource) Path() addrs.ModuleInstance {
|
||||||
|
return n.NodeAbstractResource.Path()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue