Skip to content

Commit

Permalink
addrs: AbsModuleCallOutput to ConfigOutputValue translation
Browse files Browse the repository at this point in the history
The end-goal is to retrieve ConfigOutputValues from References.
This ties in with the work on deprecated outputs.
  • Loading branch information
DanielMSchmidt committed Dec 9, 2024
1 parent 0d6c1d3 commit 50bc9a3
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions internal/addrs/module_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ func (m ModuleCallOutput) UniqueKey() UniqueKey {

func (m ModuleCallOutput) uniqueKeySigil() {}

func (m ModuleCallOutput) ConfigOutputValue() ConfigOutputValue {
return ConfigOutputValue{
Module: Module{m.Call.Name},
OutputValue: OutputValue{
Name: m.Name,
},
}
}

// ModuleCallInstanceOutput is the address of a particular named output produced by
// an instance of a module call.
type ModuleCallInstanceOutput struct {
Expand Down Expand Up @@ -210,3 +219,24 @@ func (co ModuleCallInstanceOutput) AbsOutputValue(caller ModuleInstance) AbsOutp
moduleAddr := co.Call.ModuleInstance(caller)
return moduleAddr.OutputValue(co.Name)
}

type AbsModuleCallOutput struct {
Call AbsModuleCall
Name string
}

func (c AbsModuleCall) Output(name string) AbsModuleCallOutput {
return AbsModuleCallOutput{
Call: c,
Name: name,
}
}

func (m AbsModuleCallOutput) ConfigOutputValue() ConfigOutputValue {
return ConfigOutputValue{
Module: m.Call.StaticModule(),
OutputValue: OutputValue{
Name: m.Name,
},
}
}

0 comments on commit 50bc9a3

Please sign in to comment.