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:
James Bardin 2020-01-09 14:00:45 -05:00
parent b6a041af2b
commit a6cdfad590
1 changed files with 32 additions and 1 deletions

View File

@ -281,13 +281,34 @@ type NodeDestroyResource struct {
}
var (
_ GraphNodeEvalable = (*NodeDestroyResource)(nil)
_ GraphNodeResource = (*NodeDestroyResource)(nil)
_ GraphNodeReferenceable = (*NodeDestroyResource)(nil)
_ GraphNodeReferencer = (*NodeDestroyResource)(nil)
_ GraphNodeEvalable = (*NodeDestroyResource)(nil)
)
func (n *NodeDestroyResource) Name() string {
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
func (n *NodeDestroyResource) EvalTree() EvalNode {
// 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,
}
}
// GraphNodeResource
func (n *NodeDestroyResource) ResourceAddr() addrs.AbsResource {
return n.NodeAbstractResource.ResourceAddr()
}
// GraphNodeSubpath
func (n *NodeDestroyResource) Path() addrs.ModuleInstance {
return n.NodeAbstractResource.Path()
}