addrs: All AbsMovable implementations implement UniqueKeyer

This commit is contained in:
Martin Atkins 2021-07-28 18:25:00 -07:00
parent fc63c1949d
commit ae2c93f255
3 changed files with 17 additions and 0 deletions

View File

@ -70,6 +70,14 @@ func (c AbsModuleCall) Instance(key InstanceKey) ModuleInstance {
return ret return ret
} }
type absModuleCallInstanceKey string
func (c AbsModuleCall) UniqueKey() UniqueKey {
return absModuleCallInstanceKey(c.String())
}
func (mk absModuleCallInstanceKey) uniqueKeySigil() {}
// ModuleCallInstance is the address of one instance of a module created from // ModuleCallInstance is the address of one instance of a module created from
// a module call, which might create multiple instances using "count" or // a module call, which might create multiple instances using "count" or
// "for_each" arguments. // "for_each" arguments.

View File

@ -11,6 +11,7 @@ package addrs
// the current module where the address is defined. The type MoveEndpoint // the current module where the address is defined. The type MoveEndpoint
type AbsMoveable interface { type AbsMoveable interface {
absMoveableSigil() absMoveableSigil()
UniqueKeyer
String() string String() string
} }

View File

@ -194,6 +194,14 @@ func (r AbsResource) absMoveableSigil() {
// AbsResource is moveable // AbsResource is moveable
} }
type absResourceKey string
func (r AbsResource) UniqueKey() UniqueKey {
return absResourceInstanceKey(r.String())
}
func (rk absResourceKey) uniqueKeySigil() {}
// AbsResourceInstance is an absolute address for a resource instance under a // AbsResourceInstance is an absolute address for a resource instance under a
// given module path. // given module path.
type AbsResourceInstance struct { type AbsResourceInstance struct {