github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/node_data_destroy.go (about) 1 package terraform 2 3 import ( 4 "github.com/hashicorp/terraform-plugin-sdk/internal/providers" 5 "github.com/hashicorp/terraform-plugin-sdk/internal/states" 6 ) 7 8 // NodeDestroyableDataResourceInstance represents a resource that is "destroyable": 9 // it is ready to be destroyed. 10 type NodeDestroyableDataResourceInstance struct { 11 *NodeAbstractResourceInstance 12 } 13 14 // GraphNodeEvalable 15 func (n *NodeDestroyableDataResourceInstance) EvalTree() EvalNode { 16 addr := n.ResourceInstanceAddr() 17 18 var providerSchema *ProviderSchema 19 // We don't need the provider, but we're calling EvalGetProvider to load the 20 // schema. 21 var provider providers.Interface 22 23 // Just destroy it. 24 var state *states.ResourceInstanceObject 25 return &EvalSequence{ 26 Nodes: []EvalNode{ 27 &EvalGetProvider{ 28 Addr: n.ResolvedProvider, 29 Output: &provider, 30 Schema: &providerSchema, 31 }, 32 &EvalWriteState{ 33 Addr: addr.Resource, 34 State: &state, 35 ProviderAddr: n.ResolvedProvider, 36 ProviderSchema: &providerSchema, 37 }, 38 }, 39 } 40 }