diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go b/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go index 2148cef..87a1f9c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go +++ b/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go | |||
@@ -12,6 +12,9 @@ type DeposedTransformer struct { | |||
12 | // View, if non-empty, is the ModuleState.View used around the state | 12 | // View, if non-empty, is the ModuleState.View used around the state |
13 | // to find deposed resources. | 13 | // to find deposed resources. |
14 | View string | 14 | View string |
15 | |||
16 | // The provider used by the resourced which were deposed | ||
17 | ResolvedProvider string | ||
15 | } | 18 | } |
16 | 19 | ||
17 | func (t *DeposedTransformer) Transform(g *Graph) error { | 20 | func (t *DeposedTransformer) Transform(g *Graph) error { |
@@ -33,14 +36,16 @@ func (t *DeposedTransformer) Transform(g *Graph) error { | |||
33 | if len(rs.Deposed) == 0 { | 36 | if len(rs.Deposed) == 0 { |
34 | continue | 37 | continue |
35 | } | 38 | } |
39 | |||
36 | deposed := rs.Deposed | 40 | deposed := rs.Deposed |
37 | 41 | ||
38 | for i, _ := range deposed { | 42 | for i, _ := range deposed { |
39 | g.Add(&graphNodeDeposedResource{ | 43 | g.Add(&graphNodeDeposedResource{ |
40 | Index: i, | 44 | Index: i, |
41 | ResourceName: k, | 45 | ResourceName: k, |
42 | ResourceType: rs.Type, | 46 | ResourceType: rs.Type, |
43 | Provider: rs.Provider, | 47 | ProviderName: rs.Provider, |
48 | ResolvedProvider: t.ResolvedProvider, | ||
44 | }) | 49 | }) |
45 | } | 50 | } |
46 | } | 51 | } |
@@ -50,18 +55,23 @@ func (t *DeposedTransformer) Transform(g *Graph) error { | |||
50 | 55 | ||
51 | // graphNodeDeposedResource is the graph vertex representing a deposed resource. | 56 | // graphNodeDeposedResource is the graph vertex representing a deposed resource. |
52 | type graphNodeDeposedResource struct { | 57 | type graphNodeDeposedResource struct { |
53 | Index int | 58 | Index int |
54 | ResourceName string | 59 | ResourceName string |
55 | ResourceType string | 60 | ResourceType string |
56 | Provider string | 61 | ProviderName string |
62 | ResolvedProvider string | ||
57 | } | 63 | } |
58 | 64 | ||
59 | func (n *graphNodeDeposedResource) Name() string { | 65 | func (n *graphNodeDeposedResource) Name() string { |
60 | return fmt.Sprintf("%s (deposed #%d)", n.ResourceName, n.Index) | 66 | return fmt.Sprintf("%s (deposed #%d)", n.ResourceName, n.Index) |
61 | } | 67 | } |
62 | 68 | ||
63 | func (n *graphNodeDeposedResource) ProvidedBy() []string { | 69 | func (n *graphNodeDeposedResource) ProvidedBy() string { |
64 | return []string{resourceProvider(n.ResourceName, n.Provider)} | 70 | return resourceProvider(n.ResourceName, n.ProviderName) |
71 | } | ||
72 | |||
73 | func (n *graphNodeDeposedResource) SetProvider(p string) { | ||
74 | n.ResolvedProvider = p | ||
65 | } | 75 | } |
66 | 76 | ||
67 | // GraphNodeEvalable impl. | 77 | // GraphNodeEvalable impl. |
@@ -81,7 +91,7 @@ func (n *graphNodeDeposedResource) EvalTree() EvalNode { | |||
81 | Node: &EvalSequence{ | 91 | Node: &EvalSequence{ |
82 | Nodes: []EvalNode{ | 92 | Nodes: []EvalNode{ |
83 | &EvalGetProvider{ | 93 | &EvalGetProvider{ |
84 | Name: n.ProvidedBy()[0], | 94 | Name: n.ResolvedProvider, |
85 | Output: &provider, | 95 | Output: &provider, |
86 | }, | 96 | }, |
87 | &EvalReadStateDeposed{ | 97 | &EvalReadStateDeposed{ |
@@ -98,7 +108,7 @@ func (n *graphNodeDeposedResource) EvalTree() EvalNode { | |||
98 | &EvalWriteStateDeposed{ | 108 | &EvalWriteStateDeposed{ |
99 | Name: n.ResourceName, | 109 | Name: n.ResourceName, |
100 | ResourceType: n.ResourceType, | 110 | ResourceType: n.ResourceType, |
101 | Provider: n.Provider, | 111 | Provider: n.ResolvedProvider, |
102 | State: &state, | 112 | State: &state, |
103 | Index: n.Index, | 113 | Index: n.Index, |
104 | }, | 114 | }, |
@@ -114,7 +124,7 @@ func (n *graphNodeDeposedResource) EvalTree() EvalNode { | |||
114 | Node: &EvalSequence{ | 124 | Node: &EvalSequence{ |
115 | Nodes: []EvalNode{ | 125 | Nodes: []EvalNode{ |
116 | &EvalGetProvider{ | 126 | &EvalGetProvider{ |
117 | Name: n.ProvidedBy()[0], | 127 | Name: n.ResolvedProvider, |
118 | Output: &provider, | 128 | Output: &provider, |
119 | }, | 129 | }, |
120 | &EvalReadStateDeposed{ | 130 | &EvalReadStateDeposed{ |
@@ -147,7 +157,7 @@ func (n *graphNodeDeposedResource) EvalTree() EvalNode { | |||
147 | &EvalWriteStateDeposed{ | 157 | &EvalWriteStateDeposed{ |
148 | Name: n.ResourceName, | 158 | Name: n.ResourceName, |
149 | ResourceType: n.ResourceType, | 159 | ResourceType: n.ResourceType, |
150 | Provider: n.Provider, | 160 | Provider: n.ResolvedProvider, |
151 | State: &state, | 161 | State: &state, |
152 | Index: n.Index, | 162 | Index: n.Index, |
153 | }, | 163 | }, |