mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
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
|
// GraphNodeReferenceable
|
||||||
func (n *NodeApplyableOutput) ReferenceableName() []string {
|
func (n *NodeApplyableOutput) ReferenceableName() []string {
|
||||||
return []string{n.Name()}
|
name := fmt.Sprintf("output.%s", n.Config.Name)
|
||||||
|
return []string{name}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferencer
|
// GraphNodeReferencer
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/config/module"
|
"github.com/hashicorp/terraform/config/module"
|
||||||
|
"github.com/hashicorp/terraform/dag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OutputTransformer is a GraphTransformer that adds all the outputs
|
// 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 {
|
for _, o := range os {
|
||||||
// Build the node
|
// Build the node
|
||||||
node := &NodeApplyableOutput{
|
node := &NodeApplyableOutput{
|
||||||
PathValue: m.Path(),
|
PathValue: normalizeModulePath(m.Path()),
|
||||||
Config: o,
|
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
|
// If the node references nothing, we always include it since there
|
||||||
// is no other clear time to compute it.
|
// is no other clear time to compute it.
|
||||||
matches, missing := refMap.References(node)
|
matches, missing := refMap.References(node)
|
||||||
if len(matches) == 0 || len(missing) > 0 {
|
if len(missing) > 0 {
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"[INFO] Not including %q in graph, matches: %v, missing: %s",
|
"[INFO] Not including %q in graph, matches: %v, missing: %s",
|
||||||
node, matches, missing)
|
dag.VertexName(node), matches, missing)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func NewReferenceMap(vs []dag.Vertex) *ReferenceMap {
|
|||||||
var prefix string
|
var prefix string
|
||||||
if pn, ok := v.(GraphNodeSubPath); ok {
|
if pn, ok := v.(GraphNodeSubPath); ok {
|
||||||
if path := normalizeModulePath(pn.Path()); len(path) > 1 {
|
if path := normalizeModulePath(pn.Path()); len(path) > 1 {
|
||||||
prefix = modulePrefixStr(path[1:]) + "."
|
prefix = modulePrefixStr(path) + "."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user