Skip to content

Commit

Permalink
Add more debug logging to help debug issues in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
yorinasub17 committed Nov 11, 2019
1 parent d9e6bd0 commit 57e2d7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
31 changes: 0 additions & 31 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func shouldReturnMockOutputs(dependencyConfig Dependency, terragruntOptions *opt
// terragrunt config and extract the desired output from the remote state. Note that this will error if the targetted
// module hasn't been applied yet.
func getTerragruntOutput(dependencyConfig Dependency, terragruntOptions *options.TerragruntOptions) (*cty.Value, bool, error) {

// target config check: make sure the target config exists
targetConfig := getCleanedTargetConfigPath(dependencyConfig, terragruntOptions)
if !util.FileExists(targetConfig) {
Expand Down Expand Up @@ -309,6 +310,11 @@ func getOutputJsonWithCaching(targetConfig string, terragruntOptions *options.Te
defer actualLock.Unlock()
actualLock.Lock()

// This debug log is useful for validating if the locking mechanism is working. If the locking mechanism is working,
// we should only see one pair of logs at a time that begin with this statement, and then the relevant "terraform
// output" log for the dependency.
util.Debugf(terragruntOptions.Logger, "Getting output of dependency %s for config %s", targetConfig, terragruntOptions.TerragruntConfigPath)

// Look up if we have already run terragrunt output for this target config
rawJsonBytes, hasRun := jsonOutputCache.Load(targetConfig)
if hasRun {
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ var VERSION string

// The main entrypoint for Terragrunt
func main() {
// Log the terragrunt version in debug mode. This helps with debugging issues and ensuring a specific version of
// terragrunt used.
util.Debugf(util.CreateLogger(""), "Terragrunt Version: %s", VERSION)

defer errors.Recover(checkForErrorsAndExit)

app := cli.CreateTerragruntCli(VERSION, os.Stdout, os.Stderr)
Expand Down

0 comments on commit 57e2d7d

Please sign in to comment.