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.
pull/19086/head
Martin Atkins 8 years ago
parent c8f186b303
commit 17d8ec6b6f

@ -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

@ -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()

Loading…
Cancel
Save