Skip to content

Commit

Permalink
Log terraform command before run
Browse files Browse the repository at this point in the history
Derived from:
#53 (comment)

If teraform plan takes a long time, it looks like tfmigrate plan is hanging.
To help understand what's happening, log a command string before executing it.
  • Loading branch information
minamijoyo committed Nov 24, 2021
1 parent 9e669b1 commit c0f52c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tfexec/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (e *executor) NewCommandContext(ctx context.Context, name string, args ...s

// Run executes a command.
func (e *executor) Run(cmd Command) error {
err := cmd.Run()
log.Printf("[DEBUG] [executor@%s]$ %s", e.dir, strings.Join(cmd.Args(), " "))
err := cmd.Run()
log.Printf("[TRACE] [executor@%s] cmd=%s ", e.dir, spew.Sdump(cmd))
if err != nil {
log.Printf("[DEBUG] [executor@%s] failed to run command: %s", e.dir, spew.Sdump(err))
Expand Down

0 comments on commit c0f52c0

Please sign in to comment.