Skip to content

Commit

Permalink
fix: run terraform commands with -no-color flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Nov 7, 2024
1 parent a604f1c commit 3c0c59b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions extensions/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func initActionAutoApprove(terraformClientPath string, tfAction, tfEntrypoint st
return fmt.Errorf("error: could not change to directory %s: %w", tfEntrypoint, err)
}

err = internal.ExecShellWithVars(tfEnvs, terraformClientPath, "init", "-force-copy")
err = internal.ExecShellWithVars(tfEnvs, terraformClientPath, "init", "-force-copy", "-no-color")
if err != nil {
log.Error().Msgf("error: terraform init for %s failed: %s", tfEntrypoint, err)
return fmt.Errorf("error: terraform init for %s failed: %w", tfEntrypoint, err)
}

err = internal.ExecShellWithVars(tfEnvs, terraformClientPath, tfAction, "-auto-approve")
err = internal.ExecShellWithVars(tfEnvs, terraformClientPath, tfAction, "-auto-approve", "-no-color")
if err != nil {
log.Error().Msgf("error: terraform %s -auto-approve for %s failed %s", tfAction, tfEntrypoint, err)
return fmt.Errorf("error: terraform %s -auto-approve for %s failed: %w", tfAction, tfEntrypoint, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func initActionAutoApprove(terraformClientPath, tfAction, tfEntrypoint string, t
log.Info().Msg("error: could not change to directory " + tfEntrypoint)
return fmt.Errorf("failed to change directory to %q: %w", tfEntrypoint, err)
}
err = pkg.ExecShellWithVars(tfEnvs, terraformClientPath, "init", "-force-copy")
err = pkg.ExecShellWithVars(tfEnvs, terraformClientPath, "init", "-force-copy", "-no-color")
if err != nil {
log.Printf("error: terraform init for %s failed: %s", tfEntrypoint, err)
return fmt.Errorf("terraform init for %q failed: %w", tfEntrypoint, err)
}

err = pkg.ExecShellWithVars(tfEnvs, terraformClientPath, tfAction, "-auto-approve", fmt.Sprintf("-parallelism=%d", runtime.NumCPU()*2))
err = pkg.ExecShellWithVars(tfEnvs, terraformClientPath, tfAction, "-auto-approve", fmt.Sprintf("-parallelism=%d", runtime.NumCPU()*2), "-no-color")
if err != nil {
log.Printf("error: terraform %s -auto-approve for %s failed %s", tfAction, tfEntrypoint, err)
return fmt.Errorf("terraform %s -auto-approve for %q failed: %w", tfAction, tfEntrypoint, err)
Expand Down

0 comments on commit 3c0c59b

Please sign in to comment.