#6909·terragrunt

discovery ignores terragrunt.hcl.json, breaking --filter/find/list for JSON-configured units

Author: zokujiCreated Sep 15, 2026Updated Sep 15, 2026

Describe the bug

Units configured solely via terragrunt.hcl.json (instead of terragrunt.hcl) are silently excluded from the component discovery used by --filter, find, list, and run --all. The classic config loader has always accepted terragrunt.hcl.json (pkg/config.DefaultTerragruntConfigPaths), so this is inconsistent and surprising: a unit that terragrunt run works fine in directly is invisible to filter-based discovery.

Root cause

internal/discovery/helpers.go:

go
// DefaultConfigFilenames are the default Terragrunt config filenames used in discovery.
var DefaultConfigFilenames = []string{config.DefaultTerragruntConfigPath, config.DefaultStackFile}

This only lists terragrunt.hcl and terragrunt.stack.hcl. internal/discovery/phase_filesystem.go walks the filesystem and calls createComponentFromPath, which does an exact basename match against this list. A directory containing only terragrunt.hcl.json never matches, so it's never added to the component graph that --filter (and everything built on Discovery.Discover) operates on.

To Reproduce

bash
mkdir -p repro/json-unit repro/hcl-unit
cat > repro/json-unit/terragrunt.hcl.json <<'JSON'
{ "terraform": { "source": "." } }
JSON
cat > repro/hcl-unit/terragrunt.hcl <<'HCL'
terraform {
  source = "."
}
HCL
cd repro
terragrunt find --filter '*' --non-interactive
# Prints only: hcl-unit
# json-unit is missing entirely.

terragrunt list --non-interactive
# Also only prints: hcl-unit

Expected behavior

Both hcl-unit and json-unit should be discovered and printed.

Terragrunt version

Reproduced on v1.1.4, and confirmed still present on main (41f09ad, 2026-09-14).

Additional context

I have a fix ready (adding config.DefaultTerragruntJSONConfigPath to DefaultConfigFilenames, plus a regression test) and will open a PR referencing this issue.