core: use correct fallback provider address for abstract resource instance

Previously we were attempting to construct a default manually here, and
actually getting it wrong by using the resource type name as a whole
rather than the expected inferrence by prefix.

Now we use the method provided in the addrs package for this purpose,
which implements the standard behavior of shaving off the first
underscore-separated word from the resource type name.
This commit is contained in:
Martin Atkins 2018-05-09 16:29:10 -07:00
parent f82c192c49
commit b73e4ede5d
1 changed files with 1 additions and 1 deletions

View File

@ -342,7 +342,7 @@ func (n *NodeAbstractResourceInstance) ProvidedBy() (addrs.AbsProviderConfig, bo
Guess: Guess:
// Use our type and containing module path to guess a provider configuration address // Use our type and containing module path to guess a provider configuration address
return addrs.NewDefaultProviderConfig(n.Addr.Resource.Type).Absolute(n.Addr.Module), false return n.Addr.Resource.DefaultProviderConfig().Absolute(n.Path()), false
} }
// GraphNodeProvisionerConsumer // GraphNodeProvisionerConsumer