From 91ad87311340923da8180c11b86ed511bba98671 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 11 Jul 2014 11:20:18 -0700 Subject: [PATCH] helper/resource: improve logging and output for tests --- helper/resource/map.go | 6 ++++++ helper/resource/testing.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/helper/resource/map.go b/helper/resource/map.go index 9ed671236..153bf56e4 100644 --- a/helper/resource/map.go +++ b/helper/resource/map.go @@ -62,6 +62,12 @@ func (m *Map) Apply( if s.ID == "" { result, err = r.Create(s, d, meta) } else { + if r.Update == nil { + return s, fmt.Errorf( + "Resource type '%s' doesn't support update", + s.Type) + } + result, err = r.Update(s, d, meta) } if result != nil { diff --git a/helper/resource/testing.go b/helper/resource/testing.go index fc03d1cfb..be09e744d 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -202,9 +202,11 @@ func testStep( } // Plan! - if _, err := ctx.Plan(&terraform.PlanOpts{Destroy: step.Destroy}); err != nil { + if p, err := ctx.Plan(&terraform.PlanOpts{Destroy: step.Destroy}); err != nil { return state, fmt.Errorf( "Error planning: %s", err) + } else { + log.Printf("[WARN] Test: Step plan: %s", p) } // Apply!