From e56f14a781503b5be3250ba96ee88f4488019086 Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Fri, 25 Oct 2019 18:15:06 -0700 Subject: [PATCH] Log output of failed terraform workspace new cmd --- server/events/runtime/plan_step_runner.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/events/runtime/plan_step_runner.go b/server/events/runtime/plan_step_runner.go index 0dab24a118..016754233b 100644 --- a/server/events/runtime/plan_step_runner.go +++ b/server/events/runtime/plan_step_runner.go @@ -149,8 +149,10 @@ func (p *PlanStepRunner) switchWorkspace(ctx models.ProjectCommandContext, path if err != nil { // If terraform workspace select fails we run terraform workspace // new to create a new workspace automatically. - _, err = p.TerraformExecutor.RunCommandWithVersion(ctx.Log, path, []string{workspaceCmd, "new", "-no-color", ctx.Workspace}, envs, tfVersion, ctx.Workspace) - return err + out, err := p.TerraformExecutor.RunCommandWithVersion(ctx.Log, path, []string{workspaceCmd, "new", "-no-color", ctx.Workspace}, envs, tfVersion, ctx.Workspace) + if err != nil { + return fmt.Errorf("%s: %s", err, out) + } } return nil }