From c89e02c54518ed7355f45d563bd16550f4a09ed0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 16 Jul 2014 16:40:54 -0700 Subject: [PATCH] helper/diff: fix problems with PreProcess --- helper/diff/resource_builder.go | 2 +- helper/diff/resource_builder_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helper/diff/resource_builder.go b/helper/diff/resource_builder.go index 00a172f43..53f1a6839 100644 --- a/helper/diff/resource_builder.go +++ b/helper/diff/resource_builder.go @@ -96,7 +96,7 @@ func (b *ResourceBuilder) Diff( // If we have a pre-processor for this, run it. if pp, ok := b.PreProcess[k]; ok { - v = pp(k) + v = pp(v) } } diff --git a/helper/diff/resource_builder_test.go b/helper/diff/resource_builder_test.go index dac74ff85..8f2a99c86 100644 --- a/helper/diff/resource_builder_test.go +++ b/helper/diff/resource_builder_test.go @@ -206,8 +206,8 @@ func TestResourceBuilder_preProcess(t *testing.T) { }, PreProcess: map[string]PreProcessFunc{ - "foo": func(string) string { - return "bar" + "foo": func(v string) string { + return "bar" + v }, }, } @@ -413,7 +413,7 @@ const testRBNewDiff = `UPDATE ` const testRBPreProcessDiff = `CREATE - IN foo: "" => "bar" (forces new resource) + IN foo: "" => "barfoo" (forces new resource) ` const testRBPreProcessUnknownDiff = `CREATE