diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go b/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go new file mode 100644 index 0000000..9b02362 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go | |||
@@ -0,0 +1,53 @@ | |||
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 | } | ||