Skip to content

Commit

Permalink
Merge pull request #110 from Originate/mb-silence-terraform-remote-co…
Browse files Browse the repository at this point in the history
…nfig

Redirect the output of `terraform remote config` to stderr
  • Loading branch information
brikis98 authored Jan 28, 2017
2 parents 0f31edf + 007b57c commit df95479
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shell/run_shell_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import (
"os"
"os/exec"
"os/signal"
"reflect"
"strings"

"github.com/gruntwork-io/terragrunt/errors"
"github.com/gruntwork-io/terragrunt/options"
)

// Run the specified shell command with the specified arguments. Connect the command's stdin, stdout, and stderr to
// the currently running app.
func RunShellCommand(terragruntOptions *options.TerragruntOptions, command string, args ... string) error {
func RunShellCommand(terragruntOptions *options.TerragruntOptions, command string, args ...string) error {
terragruntOptions.Logger.Printf("Running command: %s %s", command, strings.Join(args, " "))

cmd := exec.Command(command, args...)
Expand All @@ -22,6 +24,13 @@ func RunShellCommand(terragruntOptions *options.TerragruntOptions, command strin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

// Terragrunt can run some commands (such as terraform remote config) before running the actual terraform
// command requested by the user. The output of these other commands should not end up on stdout as this
// breaks scripts relying on terraform's output.
if !reflect.DeepEqual(terragruntOptions.TerraformCliArgs, args) {
cmd.Stdout = os.Stderr
}

cmd.Dir = terragruntOptions.WorkingDir

signalChannel := NewSignalsForwarder(forwardSignals, cmd.Process, terragruntOptions.Logger)
Expand Down
Binary file added terragrunt
Binary file not shown.

0 comments on commit df95479

Please sign in to comment.