terraform: fix references to module outputs

This commit is contained in:
Mitchell Hashimoto 2016-09-16 00:05:57 -07:00
parent 0d7674b079
commit 7d07f20893
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 7 additions and 5 deletions

View File

@ -29,7 +29,8 @@ func (n *NodeApplyableOutput) Path() []string {
// GraphNodeReferenceable
func (n *NodeApplyableOutput) ReferenceableName() []string {
return []string{n.Name()}
name := fmt.Sprintf("output.%s", n.Config.Name)
return []string{name}
}
// GraphNodeReferencer

View File

@ -4,6 +4,7 @@ import (
"log"
"github.com/hashicorp/terraform/config/module"
"github.com/hashicorp/terraform/dag"
)
// OutputTransformer is a GraphTransformer that adds all the outputs
@ -48,7 +49,7 @@ func (t *OutputTransformer) transform(g *Graph, m *module.Tree) error {
for _, o := range os {
// Build the node
node := &NodeApplyableOutput{
PathValue: m.Path(),
PathValue: normalizeModulePath(m.Path()),
Config: o,
}
@ -59,10 +60,10 @@ func (t *OutputTransformer) transform(g *Graph, m *module.Tree) error {
// If the node references nothing, we always include it since there
// is no other clear time to compute it.
matches, missing := refMap.References(node)
if len(matches) == 0 || len(missing) > 0 {
if len(missing) > 0 {
log.Printf(
"[INFO] Not including %q in graph, matches: %v, missing: %s",
node, matches, missing)
dag.VertexName(node), matches, missing)
continue
}

View File

@ -101,7 +101,7 @@ func NewReferenceMap(vs []dag.Vertex) *ReferenceMap {
var prefix string
if pn, ok := v.(GraphNodeSubPath); ok {
if path := normalizeModulePath(pn.Path()); len(path) > 1 {
prefix = modulePrefixStr(path[1:]) + "."
prefix = modulePrefixStr(path) + "."
}
}