terraform: fix references to module outputs
This commit is contained in:
parent
0d7674b079
commit
7d07f20893
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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) + "."
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue