don't add duplicate proxy provider nodes
Fix the logic to add proxy provider nodes for implicitly passed in providers. The missing continue allowed multiple nodes satisfying the same provider address to be added to the graph. When attaching the providers to resources, the fist one encountered would be used, which could change each time the graph was built.
This commit is contained in:
parent
2b4e389839
commit
e417d796a0
|
@ -227,7 +227,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if this in an inherited provider
|
// see if this is a proxy provider pointing to another concrete config
|
||||||
if p, ok := target.(*graphNodeProxyProvider); ok {
|
if p, ok := target.(*graphNodeProxyProvider); ok {
|
||||||
g.Remove(p)
|
g.Remove(p)
|
||||||
target = p.Target()
|
target = p.Target()
|
||||||
|
@ -708,10 +708,13 @@ func (t *ProviderConfigTransformer) addProxyProviders(g *Graph, c *configs.Confi
|
||||||
|
|
||||||
concreteProvider := t.providers[fullName]
|
concreteProvider := t.providers[fullName]
|
||||||
|
|
||||||
// replace the concrete node with the provider passed in
|
// replace the concrete node with the provider passed in only if it is
|
||||||
if concreteProvider != nil && t.proxiable[fullName] {
|
// proxyable
|
||||||
|
if concreteProvider != nil {
|
||||||
|
if t.proxiable[fullName] {
|
||||||
g.Replace(concreteProvider, proxy)
|
g.Replace(concreteProvider, proxy)
|
||||||
t.providers[fullName] = proxy
|
t.providers[fullName] = proxy
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue