Direct Answers
- No .git directory: Terramate still discovers all
stack.hcl files by walking the filesystem from the working directory. Stack discovery is independent of Git metadata. - Disabling Git-based change detection: There is no stable configuration flag to disable Git detection globally. To process all discovered stacks unconditionally, avoid using
--changed or --changed-since flags. Commands like terramate generate or terramate run without these flags will process every discovered stack. - Untracked vs. Uncommitted files: In a valid Git repository, untracked
stack.hcl files are discovered by the CLI but are excluded from --changed output because they lack history. Uncommitted changes to already tracked stack.hcl files are included in --changed detection.
Discovery vs. Change Detection
It is important to distinguish between the two phases of Terramate's operation:
- Stack Discovery: A filesystem walk that locates every
stack.hcl file. This requires no Git context. - Change Detection: The process of filtering stacks based on modifications. This typically requires a readable
.git directory to compare states.
If you run Terramate in an environment without Git, you can still orchestrate your stacks, but you cannot use the built-in Git-based filtering to target only modified components.
Experimental Filesystem Strategy
For versions 0.7 and later, Terramate introduced an experimental filesystem-based change detection strategy. This uses timestamps instead of Git metadata. It can be enabled via an environment variable:
export TM_CHANGE_DETECTION_STRATEGY=fs
terramate list --changed
Caution: This mode is experimental. It may not reliably detect file renames or deletions and is subject to change between minor versions.
Git Repository Behavior Matrix
| File State | Discovered by terramate list | Included in --changed |
|---|
| Tracked, committed | Yes | Only if modified |
| Tracked, uncommitted | Yes | Yes |
| Untracked (new file) | Yes | No |
Ignored by .gitignore | Yes | No |
Verification and Diagnostics
To verify your current environment's behavior, you can use the following scoped commands:
- Verify Discovery: Create a directory without
.git, add a stack.hcl, and run terramate list. - Verify Git Metadata: Run
terramate debug git to check if the CLI can read the repository metadata. - Verify Untracked Status: In a Git repo, add a new
stack.hcl and compare the output of terramate list vs terramate list --changed.
Missing Diagnostic Detail
What Terramate version are you using, and does your environment utilize shallow clones (e.g., fetch-depth: 1 in GitHub Actions)? Shallow clones often remove the history required for --changed to function, which may necessitate the fs strategy or avoiding filters entirely.