diff --git a/config/config.go b/config/config.go index e220e8a483..c8c7c9ae31 100644 --- a/config/config.go +++ b/config/config.go @@ -70,10 +70,10 @@ type ProviderConfig struct { Version string RawConfig *RawConfig - // Scope records where the Provider was declared in a module tree, so that - // it can be copied into child module providers yes still interpolated in + // Path records where the Provider was declared in a module tree, so that + // it can be copied into child module providers yet still interpolated in // the correct scope. - Scope []string + Path []string } // A resource represents a single Terraform resource in the configuration. diff --git a/config/module/tree.go b/config/module/tree.go index f01ed180eb..6593f48f15 100644 --- a/config/module/tree.go +++ b/config/module/tree.go @@ -364,8 +364,8 @@ func (t *Tree) inheritProviderConfigs(stack []*Tree) { continue } - pc.Scope = pt.Path() - pc.Scope = append([]string{RootName}, pt.path...) + pc.Path = pt.Path() + pc.Path = append([]string{RootName}, pt.path...) pc.RawConfig = parentProvider.RawConfig log.Printf("[TRACE] provider %q inheriting config from %q", strings.Join(append(t.Path(), pc.FullName()), "."), @@ -430,7 +430,7 @@ func (t *Tree) inheritProviderConfigs(stack []*Tree) { // Copy it in, but set an interpolation Scope. // An interpolation Scope always need to have "root" - pc.Scope = append([]string{RootName}, parent.path...) + pc.Path = append([]string{RootName}, parent.path...) pc.RawConfig = parentProvider.RawConfig log.Printf("[TRACE] provider %q inheriting config from %q", strings.Join(append(t.Path(), pc.FullName()), "."), diff --git a/config/module/tree_test.go b/config/module/tree_test.go index e71842f3cd..1b9c552972 100644 --- a/config/module/tree_test.go +++ b/config/module/tree_test.go @@ -566,8 +566,8 @@ func TestTreeProviders_basic(t *testing.T) { ) } - if !reflect.DeepEqual(aTop.Scope, []string{RootName}) { - log.Fatalf(`expected scope for "top": {"root"}, got %#v`, aTop.Scope) + if !reflect.DeepEqual(aTop.Path, []string{RootName}) { + log.Fatalf(`expected scope for "top": {"root"}, got %#v`, aTop.Path) } if !reflect.DeepEqual(bBottom.RawConfig.RawMap(), bottomRaw.RawConfig.RawMap()) { @@ -576,8 +576,8 @@ func TestTreeProviders_basic(t *testing.T) { bBottom.RawConfig.RawMap(), ) } - if !reflect.DeepEqual(bBottom.Scope, []string{RootName, "a"}) { - t.Fatalf(`expected scope for "bottom": {"root", "a"}, got %#v`, bBottom.Scope) + if !reflect.DeepEqual(bBottom.Path, []string{RootName, "a"}) { + t.Fatalf(`expected scope for "bottom": {"root", "a"}, got %#v`, bBottom.Path) } } @@ -608,8 +608,8 @@ func TestTreeProviders_implicit(t *testing.T) { t.Fatal("could not find provider 'foo' in child module") } - if !reflect.DeepEqual([]string{RootName}, foo.Scope) { - t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Scope) + if !reflect.DeepEqual([]string{RootName}, foo.Path) { + t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Path) } expected := map[string]interface{}{ @@ -657,8 +657,8 @@ func TestTreeProviders_implicitMultiLevel(t *testing.T) { t.Fatal("could not find provider 'foo' in child module") } - if !reflect.DeepEqual([]string{RootName}, foo.Scope) { - t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Scope) + if !reflect.DeepEqual([]string{RootName}, foo.Path) { + t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Path) } expected := map[string]interface{}{ @@ -677,8 +677,8 @@ func TestTreeProviders_implicitMultiLevel(t *testing.T) { t.Fatal("could not find provider 'bar' in grandchild module") } - if !reflect.DeepEqual([]string{RootName, "child"}, bar.Scope) { - t.Fatalf(`expected bar scope of {"root", "child"}, got %#v`, bar.Scope) + if !reflect.DeepEqual([]string{RootName, "child"}, bar.Path) { + t.Fatalf(`expected bar scope of {"root", "child"}, got %#v`, bar.Path) } expected = map[string]interface{}{ diff --git a/terraform/eval_context_builtin.go b/terraform/eval_context_builtin.go index 3b65ba7faf..212ca29ebe 100644 --- a/terraform/eval_context_builtin.go +++ b/terraform/eval_context_builtin.go @@ -277,7 +277,7 @@ func (ctx *BuiltinEvalContext) InterpolateProvider( var cfg *config.RawConfig if pc != nil && pc.RawConfig != nil { - path := pc.Scope + path := pc.Path if len(path) == 0 { path = ctx.Path() }