import (
"log"
- "github.com/hashicorp/terraform/config/module"
+ "github.com/hashicorp/terraform/configs"
+ "github.com/hashicorp/terraform/states"
)
-// RemoveModuleTransformer implements GraphTransformer to add nodes indicating
+// RemovedModuleTransformer implements GraphTransformer to add nodes indicating
// when a module was removed from the configuration.
type RemovedModuleTransformer struct {
- Module *module.Tree // root module
- State *State
+ Config *configs.Config // root node in the config tree
+ State *states.State
}
func (t *RemovedModuleTransformer) Transform(g *Graph) error {
}
for _, m := range t.State.Modules {
- c := t.Module.Child(m.Path[1:])
- if c != nil {
+ cc := t.Config.DescendentForInstance(m.Addr)
+ if cc != nil {
continue
}
- log.Printf("[DEBUG] module %s no longer in config\n", modulePrefixStr(m.Path))
- g.Add(&NodeModuleRemoved{PathValue: m.Path})
+ log.Printf("[DEBUG] %s is no longer in configuration\n", m.Addr)
+ g.Add(&NodeModuleRemoved{Addr: m.Addr})
}
return nil
}