sincecutoff.com
← all changes

terragrunt mark-many-as-read enables source tracking and mark_glob_as_read

Introduced 2026-04-27 · score 0.98

HOW TO USE IT

When a unit reads files indirectly or consumes a local Terraform module, enable `mark-many-as-read` so reading-based filters can select it when those files change. Use `mark_glob_as_read(pattern)` in `locals` to record matching files; local module source files are marked automatically.

terragrunt run --all --filter 'reading=../../modules/service/**' -- plan
locals { configs = mark_glob_as_read("${get_terragrunt_dir()}/config/{*.yaml,**/*.yaml}") }
terragrunt run --all --filter 'reading=./config/**' -- plan

WHY THIS HELPS

Make reading-based filters match units that consume module files or indirectly read a collection of files.

BEFORE THIS CHANGE

Before this change, a local module source did not cause its files to be marked read; for files not tracked natively, `mark_as_read(file_path)` could mark an individual file.

REQUIREMENTS AND LIMITATIONS

  • Version: v1.0.3
  • Availability: Requires the `mark-many-as-read` experiment to be enabled; calling `mark_glob_as_read` without it returns an error.
  • --experiment mark-many-as-read (required): Enables the experiment behaviors, including `mark_glob_as_read`; the release note says the function errors without it.
  • pattern (required): Glob expanded by `mark_glob_as_read`; matches are marked read and returned as absolute paths. Uses `gobwas/glob` syntax. For any-depth matching with a wildcard trailing segment, use `{*.yaml,**/*.yaml}`.
  • reading=<path> (required): Reading-based filter expression matching units and stacks by files they read.
  • Prerequisite: Use Terragrunt v1.0.3 or later for the release-note change.
  • Prerequisite: Enable the `mark-many-as-read` experiment to use `mark_glob_as_read` and automatic local-source file tracking, per v1.0.3 release note. Current documentation says local module files are marked automatically but does not list this experiment as a prerequisite.
  • Automatic marking applies recursively to `*.tf`, `*.tf.json`, `*.hcl`, `*.tofu`, and `*.tofu.json` files under the local source path; non-source files such as `README.md` are skipped.
  • `mark_glob_as_read` uses the same `gobwas/glob` syntax as filter expressions.
  • For match-at-any-depth with a wildcard trailing segment, use `{*.yaml,**/*.yaml}` because `**` only collapses surrounding separators when adjacent segments are literals.
  • Docs conflict: Current official filter documentation says local module source files are automatically marked read without mentioning `mark-many-as-read`; current docs also say `mark_glob_as_read` is available, while the v1.0.3 release note requires the experiment. The current docs may reflect later behavior.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card