diff --git a/terraform/context.go b/terraform/context.go index eddceccae..5b7777743 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -447,11 +447,6 @@ func (c *Context) Apply() (*State, error) { shadow = real } - // TODO: remove before branch is done, we're just not ready for this yet - if c.destroy { - shadow = nil - } - // Determine the operation operation := walkApply if c.destroy { diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index 4451db330..4358c2512 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -739,7 +739,7 @@ func getContextForApply_destroyCrossProviders( }, }, &ModuleState{ - Path: []string{"root", "example"}, + Path: []string{"root", "child"}, Resources: map[string]*ResourceState{ "aws_vpc.bar": &ResourceState{ Type: "aws_vpc", diff --git a/terraform/node_resource_destroy.go b/terraform/node_resource_destroy.go index 4979f9726..af52d1e59 100644 --- a/terraform/node_resource_destroy.go +++ b/terraform/node_resource_destroy.go @@ -8,7 +8,7 @@ import ( // NodeDestroyResource represents a resource that is to be destroyed. type NodeDestroyResource struct { - NodeAbstractResource + *NodeAbstractResource } func (n *NodeDestroyResource) Name() string { @@ -149,7 +149,11 @@ func (n *NodeDestroyResource) EvalTree() EvalNode { // Make sure we handle data sources properly. &EvalIf{ If: func(ctx EvalContext) (bool, error) { - if n.Config.Mode == config.DataResourceMode { + if n.Addr == nil { + return false, fmt.Errorf("nil address") + } + + if n.Addr.Mode == config.DataResourceMode { return true, nil } diff --git a/terraform/transform_attach_config_resource.go b/terraform/transform_attach_config_resource.go index 83612fede..f2ee37e56 100644 --- a/terraform/transform_attach_config_resource.go +++ b/terraform/transform_attach_config_resource.go @@ -41,7 +41,9 @@ func (t *AttachResourceConfigTransformer) Transform(g *Graph) error { // Determine what we're looking for addr := arn.ResourceAddr() - log.Printf("[TRACE] AttachResourceConfigTransformer: Attach resource request: %s", addr) + log.Printf( + "[TRACE] AttachResourceConfigTransformer: Attach resource "+ + "config request: %s", addr) // Get the configuration. path := normalizeModulePath(addr.Path) diff --git a/terraform/transform_diff.go b/terraform/transform_diff.go index 7943af685..68e905346 100644 --- a/terraform/transform_diff.go +++ b/terraform/transform_diff.go @@ -59,7 +59,7 @@ func (t *DiffTransformer) Transform(g *Graph) error { // If we're destroying, add the destroy node if inst.Destroy { - abstract := NodeAbstractResource{Addr: addr} + abstract := &NodeAbstractResource{Addr: addr} g.Add(&NodeDestroyResource{NodeAbstractResource: abstract}) }