terraform: provider merging should be parent OVER child

This commit is contained in:
Mitchell Hashimoto 2015-02-11 18:05:04 -08:00
parent e089e34c89
commit 4089d33dea
2 changed files with 7 additions and 5 deletions

View File

@ -291,14 +291,13 @@ func TestContext2Plan_moduleProviderInherit(t *testing.T) {
}
}
/*
func TestContextPlan_moduleProviderDefaults(t *testing.T) {
func TestContext2Plan_moduleProviderDefaults(t *testing.T) {
var l sync.Mutex
var calls []string
toCount := 0
m := testModule(t, "plan-module-provider-defaults")
ctx := testContext(t, &ContextOpts{
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": func() (ResourceProvider, error) {
@ -335,7 +334,9 @@ func TestContextPlan_moduleProviderDefaults(t *testing.T) {
}
if toCount != 1 {
t.Fatal("provider in child didn't set proper config")
t.Fatalf(
"provider in child didn't set proper config\n\n"+
"toCount: %d", toCount)
}
actual := calls
@ -346,6 +347,7 @@ func TestContextPlan_moduleProviderDefaults(t *testing.T) {
}
}
/*
func TestContextPlan_moduleProviderDefaultsVar(t *testing.T) {
var l sync.Mutex
var calls []string

View File

@ -21,7 +21,7 @@ func (n *EvalConfigProvider) Eval(
// Get the parent configuration if there is one
if parent := ctx.ParentProviderConfig(n.Provider); parent != nil {
merged := parent.raw.Merge(config.raw)
merged := config.raw.Merge(parent.raw)
config = NewResourceConfig(merged)
}