terraform: Mark modules for destroy

This commit is contained in:
Armon Dadgar 2014-11-24 14:15:24 -08:00
parent 9c6280f64b
commit d5fd4dabe8
2 changed files with 8 additions and 0 deletions

View File

@ -922,6 +922,13 @@ func (c *walkContext) planDestroyWalkFn() depgraph.WalkFunc {
walkFn = func(n *depgraph.Noun) error { walkFn = func(n *depgraph.Noun) error {
switch m := n.Meta.(type) { switch m := n.Meta.(type) {
case *GraphNodeModule: 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. // Build another walkContext for this module and walk it.
wc := c.Context.walkContext(c.Operation, m.Path) wc := c.Context.walkContext(c.Operation, m.Path)

View File

@ -114,6 +114,7 @@ func (d *Diff) init() {
type ModuleDiff struct { type ModuleDiff struct {
Path []string Path []string
Resources map[string]*InstanceDiff Resources map[string]*InstanceDiff
Destroy bool // Set only by the destroy plan
} }
func (d *ModuleDiff) init() { func (d *ModuleDiff) init() {