6 "github.com/hashicorp/terraform/addrs"
7 "github.com/hashicorp/terraform/dag"
8 "github.com/hashicorp/terraform/plans"
9 "github.com/hashicorp/terraform/providers"
10 "github.com/hashicorp/terraform/states"
13 // NodePlanDestroyableResourceInstance represents a resource that is ready
14 // to be planned for destruction.
15 type NodePlanDestroyableResourceInstance struct {
16 *NodeAbstractResourceInstance
20 _ GraphNodeSubPath = (*NodePlanDestroyableResourceInstance)(nil)
21 _ GraphNodeReferenceable = (*NodePlanDestroyableResourceInstance)(nil)
22 _ GraphNodeReferencer = (*NodePlanDestroyableResourceInstance)(nil)
23 _ GraphNodeDestroyer = (*NodePlanDestroyableResourceInstance)(nil)
24 _ GraphNodeResource = (*NodePlanDestroyableResourceInstance)(nil)
25 _ GraphNodeResourceInstance = (*NodePlanDestroyableResourceInstance)(nil)
26 _ GraphNodeAttachResourceConfig = (*NodePlanDestroyableResourceInstance)(nil)
27 _ GraphNodeAttachResourceState = (*NodePlanDestroyableResourceInstance)(nil)
28 _ GraphNodeEvalable = (*NodePlanDestroyableResourceInstance)(nil)
29 _ GraphNodeProviderConsumer = (*NodePlanDestroyableResourceInstance)(nil)
33 func (n *NodePlanDestroyableResourceInstance) DestroyAddr() *addrs.AbsResourceInstance {
34 addr := n.ResourceInstanceAddr()
39 func (n *NodePlanDestroyableResourceInstance) EvalTree() EvalNode {
40 addr := n.ResourceInstanceAddr()
42 // Declare a bunch of variables that are used for state during
43 // evaluation. These are written to by address in the EvalNodes we
45 var provider providers.Interface
46 var providerSchema *ProviderSchema
47 var change *plans.ResourceInstanceChange
48 var state *states.ResourceInstanceObject
50 if n.ResolvedProvider.ProviderConfig.Type == "" {
51 // Should never happen; indicates that the graph was not constructed
52 // correctly since we didn't get our provider attached.
53 panic(fmt.Sprintf("%T %q was not assigned a resolved provider", n, dag.VertexName(n)))
59 Addr: n.ResolvedProvider,
61 Schema: &providerSchema,
66 ProviderSchema: &providerSchema,
72 ProviderAddr: n.ResolvedProvider,
76 &EvalCheckPreventDestroy{
83 ProviderSchema: &providerSchema,