core: NodeAbstractResource correct default result from ProvidedBy

Previously we had a bug where we'd use the resource type name instead of
the provider name. Now we use the DefaultProviderConfig helper function
to extract the provider name from the resource type name.
This commit is contained in:
Martin Atkins 2018-05-07 17:21:30 -07:00
parent c8f186b303
commit 17d8ec6b6f
2 changed files with 2 additions and 2 deletions

View File

@ -309,7 +309,7 @@ func (n *NodeAbstractResource) ProvidedBy() (addrs.AbsProviderConfig, bool) {
}
// 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.Addr.Module), false
}
// GraphNodeProviderConsumer

View File

@ -44,7 +44,7 @@ func TestRootTransformer(t *testing.T) {
actual := strings.TrimSpace(g.String())
expected := strings.TrimSpace(testTransformRootBasicStr)
if actual != expected {
t.Fatalf("bad:\n\n%s", actual)
t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected)
}
root, err := g.Root()