From 6a977cbea66a1d68f2cd4d5014cf1cfaf8df452d Mon Sep 17 00:00:00 2001 From: Anubhav Mishra Date: Sat, 1 Jul 2017 16:51:08 -0700 Subject: [PATCH] run terraform get for 0.8.8 and below (#62) * run terraform get for 0.8.8 and below --- server/plan_executor.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/plan_executor.go b/server/plan_executor.go index c0bd85741..8377121c8 100644 --- a/server/plan_executor.go +++ b/server/plan_executor.go @@ -150,6 +150,16 @@ func (p *PlanExecutor) setupAndPlan(ctx *CommandContext) ExecutionResult { return ExecutionResult{SetupError: GeneralError{errors.New(errMsg)}} } ctx.Log.Info("terraform init and environment commands ran successfully %s", outputs) + } else { + // run terraform get for 0.8.8 and below + terraformGetCmd := append([]string{"get", "-no-color"}, config.GetExtraArguments("get")...) + _, output, err := p.terraform.RunTerraformCommand(absolutePath, terraformGetCmd, nil) + if err != nil { + errMsg := fmt.Sprintf("terraform get failed. %s %v", output, err) + ctx.Log.Err(errMsg) + return ExecutionResult{SetupError: GeneralError{errors.New(errMsg)}} + } + ctx.Log.Info("terraform get ran successfully %s", output) } // if there are pre plan commands then run them