Skip to content

hotfix:fix the terragrunt regex expression - #152

Merged
justushar merged 3 commits into
masterfrom
hotfix/v1.1.11
Jun 26, 2026
Merged

hotfix:fix the terragrunt regex expression#152
justushar merged 3 commits into
masterfrom
hotfix/v1.1.11

Conversation

@justushar

Copy link
Copy Markdown
Collaborator

WHAT

SSIA
(Write the change being made with this pull request)

WHY

The Changed Result in Default template is not being formatted properly.
(Write the motivation why you submit this pull request)

justushar and others added 2 commits June 19, 2026 07:57
The terragrunt prefix regex used `:\s*` to strip the timestamp+module
prefix from each stdout line. The greedy `\s*` ate not only the single
separator space terragrunt inserts between `tf:` and the wrapped output,
but also the leading 2/4/6/… spaces of `terraform plan`'s own diff
indentation. Result: every `# resource will be created` and `+ field =
…` line in the rendered Change Result block lands at column 0, making
the diff unreadable.

Switch the trailing `:\s*` to `: ?` (optional single space). Now exactly
the separator space is consumed; terraform's indentation survives
intact. Verified end-to-end via the localfile notifier:

  before: `+ resource "x" "y" {`         (column 0)
  after:  `  + resource "x" "y" {`       (2-space indent preserved)
  after:  `      + id = (known after apply)`  (6-space indent preserved)

Added a regression test that asserts 2- and 6-space indents survive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d mode

Terragrunt run-all prefixes each leaf module's stdout with [module/path]
brackets; the root module's lines have no bracket. The previous parser
only matched the bracketed form, so after a leaf's section ended, root
lines were attributed to the prior leaf — e.g. a root IAM change would
show up under cluster-citadel-2g/regions/tokyo/shared-vpc in the
per-module summary.

Add a LogRootModule regex matching unbracketed terragrunt log lines and
flip currentModule back to root ("") when one appears, but only when
the previous module was set by a [bracket] log prefix. Module headers
of the form `Module <path>` (no log prefix) keep working as before —
unbracketed lines that follow them stay attributed to the declared
module.
@justushar
justushar merged commit 46f06d4 into master Jun 26, 2026
3 of 4 checks passed
@justushar
justushar deleted the hotfix/v1.1.11 branch June 26, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant