addrs: Generate special string for invalid ProviderConfig
The zero value of ProviderConfig is not a valid provider config address, so we'll generate a special string for that in order to make that clear in case one sneaks in somewhere. This can happen, for example, in the core flow of resolving provider inheritance during the ProviderTransformer if a caller attempts to access the resolved provider before that transformer has run.
This commit is contained in:
parent
b0b1486c46
commit
f107a4bc33
|
@ -84,6 +84,11 @@ func (pc ProviderConfig) Absolute(module ModuleInstance) AbsProviderConfig {
|
|||
}
|
||||
|
||||
func (pc ProviderConfig) String() string {
|
||||
if pc.Type == "" {
|
||||
// Should never happen; always indicates a bug
|
||||
return "provider.<invalid>"
|
||||
}
|
||||
|
||||
if pc.Alias != "" {
|
||||
return fmt.Sprintf("provider.%s.%s", pc.Type, pc.Alias)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue