Scoping Terragrunt Discovery to the Live Stack Directory
Running terragrunt hcl validate and terragrunt find from the repository root counted my catalog templates as if they were live infrastructure units. Validation passed on files that are not deployed anywhere, and any unit count I derived was inflated by templates that exist only to be instantiated. For this push I pinned the work to the explicit stack directory so discovery means what I think it means, and added a count assertion so a silent change in that number fails the build instead of sliding past.
What changed in the validate and discovery paths
Every place that validated HCL or discovered units now names the stack directory explicitly, either with --working-dir or by changing into the stack before invoking terragrunt. In the Nix development shell and the validation workflow that means checking the real region stack rather than whatever the current directory happens to be, and in the offline static checks it means terragrunt find --filter 'type=unit' only returns units that actually live under that stack. The catalog templates remain where they are; they are simply no longer in scope for validation and counting, which is the correct treatment for files whose purpose is to be rendered into a unit. I also recorded the same discovery command in the internal pattern doc for adding a new Terragrunt unit, because that is the moment when a missing working directory is easiest to introduce and hardest to notice.
Making the unit count a real assertion
The static check now captures the discovered unit count as JSON, compares it against the expected number of explicit stack units, and exits with an error that names both figures when they disagree. This is a different kind of check from validating HCL. Validation proves the files parse and the references resolve; the count proves discovery is still looking at the same set of units I intended, so a directory move or an accidental template inclusion surfaces as a mismatch rather than as a quietly shorter or longer list. Printing discovered and expected side by side matters for diagnosis, since the common failure is off by one and I want the log to say which direction.
Localizing Langfuse storage inputs and the launch pattern
Alongside the discovery fix, the blob-storage inputs for Langfuse now live beside its app stack rather than being sourced from a central place, and reach the catalog template through the unit’s own values. That keeps app-specific configuration next to the stack that consumes it, so reading a single stack directory tells me what that app actually receives. The pattern doc carries the same lesson: identity inputs sit beside each app stack, storage inputs follow the same rule, and after generating a unit I run the scoped discovery command to confirm it appears. What this push establishes is that the static suite and the validate entry points agree with the tightened scope; it does not establish a live apply. My next check is a dispatch that renders the Langfuse unit and confirms the storage values arrive intact through the template.