terraform: initialize and attach module state

This commit is contained in:
Armon Dadgar 2014-11-21 16:41:48 -08:00
parent 6e1ef1c634
commit ec1c026b80
1 changed files with 8 additions and 0 deletions

View File

@ -362,6 +362,14 @@ func graphAddConfigModules(
if n, err := graphModuleNoun(m.Name, m, g, opts); err != nil {
return err
} else {
// Attach the module state if any
if opts.State != nil {
module := n.Meta.(*GraphNodeModule)
module.State = opts.State.ModuleByPath(module.Path)
if module.State == nil {
module.State = opts.State.AddModule(module.Path)
}
}
nounsList = append(nounsList, n)
}
}