Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 committed Dec 9, 2024
1 parent 47d7b3d commit 6b1772c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/terraform/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func GetCommonOptions(options *Options, args ...string) (*Options, []string) {
}
_, tgLogSet := options.EnvVars["TERRAGRUNT_LOG_FORMAT"]
if !tgLogSet {
// key-value format for terragrunt logs to avoid colors and have plain form
// https://terragrunt.gruntwork.io/docs/reference/cli-options/#terragrunt-log-format
options.EnvVars["TERRAGRUNT_LOG_FORMAT"] = "key-value"
}
_, tgLogFormat := options.EnvVars["TERRAGRUNT_LOG_CUSTOM_FORMAT"]
Expand Down
4 changes: 3 additions & 1 deletion modules/terraform/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
const skipJsonLogLine = " msg="

var (
// ansiLineRegex matches lines starting with ANSI escape codes for text formatting (e.g., colors, styles).
ansiLineRegex = regexp.MustCompile(`(?m)^\x1b\[[0-9;]*m.*`)
tgLogLevel = regexp.MustCompile(`.*time=\S+ level=\S+ prefix=\S+ binary=\S+ msg=.*`)
// tgLogLevel matches log lines containing fields for time, level, prefix, binary, and message, each with non-whitespace values.
tgLogLevel = regexp.MustCompile(`.*time=\S+ level=\S+ prefix=\S+ binary=\S+ msg=.*`)
)

// Output calls terraform output for the given variable and return its string value representation.
Expand Down

0 comments on commit 6b1772c

Please sign in to comment.