stackaddrs: ConfigComponentForAbsInstance

This helper discards all of the instance keys from an AbsComponentInstance
to find the corresponding ConfigComponent.
pull/34738/head
Martin Atkins 3 years ago
parent dd04b2caef
commit edc02f2a06

@ -67,6 +67,16 @@ type ConfigComponentInstance = InStackConfig[ComponentInstance]
// particular [StackInstance].
type AbsComponentInstance = InStackInstance[ComponentInstance]
func ConfigComponentForAbsInstance(instAddr AbsComponentInstance) ConfigComponent {
configInst := ConfigForAbs(instAddr) // a ConfigComponentInstance
return ConfigComponent{
Stack: configInst.Stack,
Item: Component{
Name: configInst.Item.Component.Name,
},
}
}
func ParseAbsComponentInstance(traversal hcl.Traversal) (AbsComponentInstance, tfdiags.Diagnostics) {
if traversal.IsRelative() {
// This is always a caller bug: caller must only pass absolute

Loading…
Cancel
Save