From c0f52c076f96af814a5638386a585bccfa8697d1 Mon Sep 17 00:00:00 2001 From: Masayuki Morita Date: Wed, 24 Nov 2021 22:40:31 +0900 Subject: [PATCH] Log terraform command before run Derived from: https://github.com/minamijoyo/tfmigrate/issues/53#issuecomment-975020063 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. --- tfexec/executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tfexec/executor.go b/tfexec/executor.go index 87c1515..abb4f98 100644 --- a/tfexec/executor.go +++ b/tfexec/executor.go @@ -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))