diff --git a/terraform/graph.go b/terraform/graph.go index e966478e8..16a8635dc 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -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) } }