make the module closer referenceable

This is all that is required to make module reference ordering work
during apply, by adding and edge to the nodeCloseModule node, which will
be the last node evaluated in the module.
This commit is contained in:
James Bardin 2020-04-06 12:52:25 -04:00
parent 3ac0410fe2
commit b1532c0f04
1 changed files with 17 additions and 0 deletions

View File

@ -99,6 +99,23 @@ type nodeCloseModule struct {
Addr addrs.Module
}
var (
_ graphNodeModuleCloser = (*nodeCloseModule)(nil)
_ GraphNodeReferenceable = (*nodeCloseModule)(nil)
)
func (n *nodeCloseModule) ModulePath() addrs.Module {
mod, _ := n.Addr.Call()
return mod
}
func (n *nodeCloseModule) ReferenceableAddrs() []addrs.Referenceable {
_, call := n.Addr.Call()
return []addrs.Referenceable{
call,
}
}
func (n *nodeCloseModule) Name() string {
if len(n.Addr) == 0 {
return "root"