diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/transform_targets.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/transform_targets.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go b/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go index 125f9e3..4f117b4 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go +++ b/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go | |||
@@ -41,6 +41,12 @@ type TargetsTransformer struct { | |||
41 | // that already have the targets parsed | 41 | // that already have the targets parsed |
42 | ParsedTargets []ResourceAddress | 42 | ParsedTargets []ResourceAddress |
43 | 43 | ||
44 | // If set, the index portions of resource addresses will be ignored | ||
45 | // for comparison. This is used when transforming a graph where | ||
46 | // counted resources have not yet been expanded, since otherwise | ||
47 | // the unexpanded nodes (which never have indices) would not match. | ||
48 | IgnoreIndices bool | ||
49 | |||
44 | // Set to true when we're in a `terraform destroy` or a | 50 | // Set to true when we're in a `terraform destroy` or a |
45 | // `terraform plan -destroy` | 51 | // `terraform plan -destroy` |
46 | Destroy bool | 52 | Destroy bool |
@@ -199,7 +205,12 @@ func (t *TargetsTransformer) nodeIsTarget( | |||
199 | 205 | ||
200 | addr := r.ResourceAddr() | 206 | addr := r.ResourceAddr() |
201 | for _, targetAddr := range addrs { | 207 | for _, targetAddr := range addrs { |
202 | if targetAddr.Equals(addr) { | 208 | if t.IgnoreIndices { |
209 | // targetAddr is not a pointer, so we can safely mutate it without | ||
210 | // interfering with references elsewhere. | ||
211 | targetAddr.Index = -1 | ||
212 | } | ||
213 | if targetAddr.Contains(addr) { | ||
203 | return true | 214 | return true |
204 | } | 215 | } |
205 | } | 216 | } |