---
version: "v1.0.3"
category: "experiments-added"
---

#### `mark-many-as-read` — Mark many files as read in one step

Enable the new [`mark-many-as-read`](/reference/experiments) experiment to turn on two behaviors that each mark many files as read in a single call: automatic marking of files inside a local `terraform { source = "..." }` block, and the new `mark_glob_as_read` HCL function.

With the experiment on, a unit like this:

```hcl
# live/unit/terragrunt.hcl
terraform {
  source = "../../modules/service"
}
```

records every `*.tf`, `*.tf.json`, `*.hcl`, `*.tofu`, and `*.tofu.json` file found under `../../modules/service` (recursively) as read for the unit. Non-source files such as `README.md` are skipped. A [reading-based filter expression](/features/filter/attributes#reading-based-expressions) such as `--filter 'reading=../../modules/service/**'` then matches every unit that points at the module, so a change to any file in the module cascades to its consumers.

The same experiment also enables a new HCL function, `mark_glob_as_read(pattern)`, which expands a glob using the same [`gobwas/glob`](https://github.com/gobwas/glob) syntax as filter expressions and marks every matching file as read. It returns the list of absolute paths that matched, so it composes with other expressions:

```hcl
locals {
  configs = mark_glob_as_read("${get_terragrunt_dir()}/config/{*.yaml,**/*.yaml}")
}
```

`**` only collapses the surrounding separators when the adjacent segments are literals, so match-at-any-depth with a wildcard trailing segment is written as `{*.yaml,**/*.yaml}`. See the [HCL reference](/reference/hcl/functions/#mark_glob_as_read) for full pattern syntax.

This is useful when a unit reads a collection of files indirectly (for example, via `run_cmd` or `templatefile`) and you want changes to any of them to trigger the unit through reading-based filters. Calling `mark_glob_as_read` without the experiment enabled returns an error.
