diff --git a/terraform/eval_provider.go b/terraform/eval_provider.go index 556588b59..e42f1c0dc 100644 --- a/terraform/eval_provider.go +++ b/terraform/eval_provider.go @@ -17,7 +17,7 @@ type EvalBuildProviderConfig struct { func (n *EvalBuildProviderConfig) Eval(ctx EvalContext) (interface{}, error) { cfg := *n.Config - // If we have a configuration set, then merge that in + // If we have an Input configuration set, then merge that in if input := ctx.ProviderInput(n.Provider); input != nil { // "input" is a map of the subset of config values that were known // during the input walk, set by EvalInputProvider. Note that @@ -29,7 +29,7 @@ func (n *EvalBuildProviderConfig) Eval(ctx EvalContext) (interface{}, error) { return nil, err } - merged := cfg.raw.Merge(rc) + merged := rc.Merge(cfg.raw) cfg = NewResourceConfig(merged) } diff --git a/terraform/eval_provider_test.go b/terraform/eval_provider_test.go index 43653a7b7..000dc5128 100644 --- a/terraform/eval_provider_test.go +++ b/terraform/eval_provider_test.go @@ -37,7 +37,7 @@ func TestEvalBuildProviderConfig(t *testing.T) { // We expect the provider config with the added input value expected := map[string]interface{}{ - "set_in_config": "input", // in practice, input map contains identical literals from config + "set_in_config": "config", "set_in_config_and_parent": "config", "computed_in_config": "config", "set_by_input": "input", diff --git a/terraform/path.go b/terraform/path.go index ca99685ad..51dd4122b 100644 --- a/terraform/path.go +++ b/terraform/path.go @@ -1,24 +1,10 @@ package terraform import ( - "crypto/md5" - "encoding/hex" + "strings" ) // PathCacheKey returns a cache key for a module path. -// -// TODO: test func PathCacheKey(path []string) string { - // There is probably a better way to do this, but this is working for now. - // We just create an MD5 hash of all the MD5 hashes of all the path - // elements. This gets us the property that it is unique per ordering. - hash := md5.New() - for _, p := range path { - single := md5.Sum([]byte(p)) - if _, err := hash.Write(single[:]); err != nil { - panic(err) - } - } - - return hex.EncodeToString(hash.Sum(nil)) + return strings.Join(path, "|") }