diff --git a/terraform/context.go b/terraform/context.go index 81735063f2..5ca407efb0 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -922,6 +922,13 @@ func (c *walkContext) planDestroyWalkFn() depgraph.WalkFunc { walkFn = func(n *depgraph.Noun) error { switch m := n.Meta.(type) { case *GraphNodeModule: + // Set the destroy bool on the module + md := result.Diff.ModuleByPath(m.Path) + if md == nil { + md = result.Diff.AddModule(m.Path) + } + md.Destroy = true + // Build another walkContext for this module and walk it. wc := c.Context.walkContext(c.Operation, m.Path) diff --git a/terraform/diff.go b/terraform/diff.go index 3770a1d471..3abb3cd4af 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -114,6 +114,7 @@ func (d *Diff) init() { type ModuleDiff struct { Path []string Resources map[string]*InstanceDiff + Destroy bool // Set only by the destroy plan } func (d *ModuleDiff) init() {