core: Only create stub provider if real provider is not present

Previously we'd create the stub provider in any case where we didn't need
a configured provider, but we also need to skip creating it if there's
already a provider node present, or else we can end up with multiple
stub nodes in the graph.
This commit is contained in:
Martin Atkins 2018-05-25 19:36:19 -07:00
parent b144497041
commit 7dc3c51a86
1 changed files with 1 additions and 1 deletions

View File

@ -210,7 +210,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
// If this provider doesn't need to be configured then we can just
// stub it out with an init-only provider node, which will just
// start up the provider and fetch its schema.
if _, exists := needConfigured[key]; !exists {
if _, exists := needConfigured[key]; target == nil && !exists {
stubAddr := p.ProviderConfig.Absolute(addrs.RootModuleInstance)
stub := &NodeEvalableProvider{
&NodeAbstractProvider{