From fa25a3051b38307b278f996ef2a9611b48713326 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 19 Oct 2016 15:05:38 -0700 Subject: [PATCH] terraform: orphan resources in old graph need unique ID --- terraform/context.go | 2 +- terraform/shadow_resource_provider.go | 2 +- terraform/transform_orphan.go | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/terraform/context.go b/terraform/context.go index d15b9f6c2..80f610919 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -435,7 +435,7 @@ func (c *Context) Apply() (*State, error) { } // Walk the graph - walker, err := c.walk(real, shadow, operation) + walker, err := c.walk(real, real, operation) if len(walker.ValidationErrors) > 0 { err = multierror.Append(err, walker.ValidationErrors...) } diff --git a/terraform/shadow_resource_provider.go b/terraform/shadow_resource_provider.go index bb80be31d..816d344a2 100644 --- a/terraform/shadow_resource_provider.go +++ b/terraform/shadow_resource_provider.go @@ -510,7 +510,7 @@ func (p *shadowResourceProviderShadow) Apply( p.ErrorLock.Lock() defer p.ErrorLock.Unlock() p.Error = multierror.Append(p.Error, fmt.Errorf( - "Unknown 'apply' shadow value: %#v", raw)) + "Unknown 'apply' shadow value for %q: %#v", key, raw)) return nil, nil } diff --git a/terraform/transform_orphan.go b/terraform/transform_orphan.go index f47f51681..27f032251 100644 --- a/terraform/transform_orphan.go +++ b/terraform/transform_orphan.go @@ -209,6 +209,8 @@ func (n *graphNodeOrphanResource) EvalTree() EvalNode { // Build instance info info := &InstanceInfo{Id: n.ResourceKey.String(), Type: n.ResourceKey.Type} + info.uniqueExtra = "destroy" + seq.Nodes = append(seq.Nodes, &EvalInstanceInfo{Info: info}) // Each resource mode has its own lifecycle