de-specify module output references

Like resource references, we need to make instance references less
specific when they aren't expanded yet during plan.
This commit is contained in:
James Bardin 2020-04-09 15:40:28 -04:00
parent a805e14283
commit b9ddec33e9
2 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,15 @@ type AbsModuleCallOutput struct {
Name string Name string
} }
// ModuelCallOutput returns the referenceable ModuleCallOutput for this
// particular instance.
func (co AbsModuleCallOutput) ModuleCallOutput() ModuleCallOutput {
return ModuleCallOutput{
Call: co.Call.Call,
Name: co.Name,
}
}
func (co AbsModuleCallOutput) String() string { func (co AbsModuleCallOutput) String() string {
return fmt.Sprintf("%s.%s", co.Call.String(), co.Name) return fmt.Sprintf("%s.%s", co.Call.String(), co.Name)
} }

View File

@ -262,6 +262,11 @@ func (m *ReferenceMap) References(v dag.Vertex) []dag.Vertex {
subject = ri.ContainingResource() subject = ri.ContainingResource()
case addrs.ResourceInstancePhase: case addrs.ResourceInstancePhase:
subject = ri.ContainingResource() subject = ri.ContainingResource()
case addrs.AbsModuleCallOutput:
subject = ri.ModuleCallOutput()
default:
log.Printf("[WARN] ReferenceTransformer: reference not found: %q", subject)
continue
} }
key = m.referenceMapKey(v, subject) key = m.referenceMapKey(v, subject)
} }