adding -upgrade to init cmd

This commit is contained in:
Andrew Urwin
2019-02-26 15:53:54 +00:00
parent 5e9464b820
commit aec79b95e1

View File

@@ -16,12 +16,12 @@ func (i *InitStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []strin
if ctx.ProjectConfig != nil && ctx.ProjectConfig.TerraformVersion != nil {
tfVersion = ctx.ProjectConfig.TerraformVersion
}
terraformInitCmd := append([]string{"init", "-input=false", "-no-color"}, extraArgs...)
terraformInitCmd := append([]string{"init", "-input=false", "-no-color", "-upgrade"}, extraArgs...)
// If we're running < 0.9 we have to use `terraform get` instead of `init`.
if MustConstraint("< 0.9.0").Check(tfVersion) {
ctx.Log.Info("running terraform version %s so will use `get` instead of `init`", tfVersion)
terraformInitCmd = append([]string{"get", "-no-color"}, extraArgs...)
terraformInitCmd = append([]string{"get", "-no-color", "-upgrade"}, extraArgs...)
}
out, err := i.TerraformExecutor.RunCommandWithVersion(ctx.Log, path, terraformInitCmd, tfVersion, ctx.Workspace)