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:
James Bardin 2021-02-18 10:17:56 -05:00
parent 2b4e389839
commit e417d796a0
1 changed files with 8 additions and 5 deletions

View File

@ -227,7 +227,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
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 {
g.Remove(p)
target = p.Target()
@ -708,10 +708,13 @@ func (t *ProviderConfigTransformer) addProxyProviders(g *Graph, c *configs.Confi
concreteProvider := t.providers[fullName]
// replace the concrete node with the provider passed in
if concreteProvider != nil && t.proxiable[fullName] {
g.Replace(concreteProvider, proxy)
t.providers[fullName] = proxy
// replace the concrete node with the provider passed in only if it is
// proxyable
if concreteProvider != nil {
if t.proxiable[fullName] {
g.Replace(concreteProvider, proxy)
t.providers[fullName] = proxy
}
continue
}