Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate/hcl: support module calls through source keyword #130

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package cmd
import (
"encoding/json"
"errors"
"io"
"io/ioutil"
"os"

"github.com/cycloidio/terracognita/log"
"github.com/spf13/cobra"
)

Expand All @@ -14,11 +16,19 @@ var (
tfstate bool
file []byte
path string
debug bool
logsOut io.Writer = ioutil.Discard

rootCmd = &cobra.Command{
Use: "inframap",
Short: "Reads the TFState or HCL to generate a Graphical view",
Long: "Reads the TFState or HCL to generate a Graphical view with Nodes and Edges.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if debug {
logsOut = os.Stdout
}
log.Init(logsOut, debug)
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to include TC for this, copy the part you need (activation of TF logs) and open an issue to add Debugging to IM (if we do not have one already)

}
)

Expand Down Expand Up @@ -101,4 +111,5 @@ func init() {

rootCmd.PersistentFlags().BoolVar(&hcl, "hcl", false, "Forces to use HCL parser")
rootCmd.PersistentFlags().BoolVar(&tfstate, "tfstate", false, "Forces to use TFState parser")
rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "Activate the debug mode wich includes TF logs via TF_LOG=TRACE|DEBUG|INFO|WARN|ERROR configuration https://www.terraform.io/docs/internals/debugging.html")
}