github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/terraform/node_resource_plan_destroy.go (about) 1 package terraform 2 3 // NodePlanDestroyableResource represents a resource that is "applyable": 4 // it is ready to be applied and is represented by a diff. 5 type NodePlanDestroyableResource struct { 6 *NodeAbstractResource 7 } 8 9 // GraphNodeDestroyer 10 func (n *NodePlanDestroyableResource) DestroyAddr() *ResourceAddress { 11 return n.Addr 12 } 13 14 // GraphNodeEvalable 15 func (n *NodePlanDestroyableResource) EvalTree() EvalNode { 16 addr := n.NodeAbstractResource.Addr 17 18 // stateId is the ID to put into the state 19 stateId := addr.stateId() 20 21 // Build the instance info. More of this will be populated during eval 22 info := &InstanceInfo{ 23 Id: stateId, 24 Type: addr.Type, 25 } 26 27 // Declare a bunch of variables that are used for state during 28 // evaluation. Most of this are written to by-address below. 29 var diff *InstanceDiff 30 var state *InstanceState 31 32 return &EvalSequence{ 33 Nodes: []EvalNode{ 34 &EvalReadState{ 35 Name: stateId, 36 Output: &state, 37 }, 38 &EvalDiffDestroy{ 39 Info: info, 40 State: &state, 41 Output: &diff, 42 }, 43 &EvalCheckPreventDestroy{ 44 Resource: n.Config, 45 Diff: &diff, 46 }, 47 &EvalWriteDiff{ 48 Name: stateId, 49 Diff: &diff, 50 }, 51 }, 52 } 53 }