diff --git a/terraform/module_dependencies.go b/terraform/module_dependencies.go index cf9a4228f..bc8e7dca7 100644 --- a/terraform/module_dependencies.go +++ b/terraform/module_dependencies.go @@ -34,7 +34,8 @@ func configTreeConfigDependencies(root *configs.Config, inheritProviders map[str // This isn't necessarily correct if we're called with a nil that // *isn't* at the root, but in practice that can never happen. return &moduledeps.Module{ - Name: "root", + Name: "root", + Providers: make(moduledeps.Providers), } } @@ -109,7 +110,7 @@ func configTreeConfigDependencies(root *configs.Config, inheritProviders map[str } reason := moduledeps.ProviderDependencyImplicit - if _, inherited := inheritProviders[addr.String()]; inherited { + if _, inherited := inheritProviders[addr.StringCompact()]; inherited { reason = moduledeps.ProviderDependencyInherited } diff --git a/terraform/module_dependencies_test.go b/terraform/module_dependencies_test.go index 4c87a4c9a..8a1af1417 100644 --- a/terraform/module_dependencies_test.go +++ b/terraform/module_dependencies_test.go @@ -3,7 +3,7 @@ package terraform import ( "testing" - "github.com/davecgh/go-spew/spew" + "github.com/go-test/deep" "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/moduledeps" "github.com/hashicorp/terraform/plugin/discovery" @@ -249,12 +249,8 @@ func TestModuleTreeDependencies(t *testing.T) { } got := ConfigTreeDependencies(root, test.State) - if !got.Equal(test.Want) { - t.Errorf( - "wrong dependency tree\ngot: %s\nwant: %s", - spew.Sdump(got), - spew.Sdump(test.Want), - ) + for _, problem := range deep.Equal(got, test.Want) { + t.Error(problem) } }) }