fix: respect autodiscover.ignore_paths during apply-all#6397
Merged
chenrui333 merged 13 commits intoApr 29, 2026
Conversation
buildAllProjectCommandsByPlan() used PendingPlanFinder.Find() which only filtered .terragrunt-cache/ directories. This meant atlantis apply (without -p) would discover and attempt to apply .tfplan files in paths that should be ignored per autodiscover.ignore_paths (e.g. .terraform/modules/). Fix: after PendingPlanFinder.Find() returns, load the repo config and filter plans through isAutoDiscoverPathIgnored() before building commands. This mirrors the filtering already done in the plan path (getMergedProjectCfgs). Also fix isAutoDiscoverPathIgnored() to fall through to repo-level config when the global config has AutoDiscover set but no IgnorePaths. Previously, the default global config (which always sets AutoDiscover with mode=auto) would shadow repo-level ignore_paths from atlantis.yaml. Fixes: runatlantis#6325 Signed-off-by: Jeff Holm <jholm117@gmail.com>
- Use IgnorePaths != nil instead of len() > 0 so an explicitly empty global ignore_paths can override repo-level config - Skip explicitly configured project dirs when filtering apply plans, matching the plan-path behavior in getMergedProjectCfgs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Jeffrey Holm <jeff.holm@scale.com>
Both buildAllCommandsByCfg and buildAllProjectCommandsByPlan were doing the same HasRepoCfg then ParseRepoCfg sequence. Extract it into a single helper so the logic lives in one place. Addresses review feedback on runatlantis#6332.
When global AutoDiscover is set with mode enabled but no IgnorePaths, the guard change (from '!= nil' to '!= nil && IgnorePaths != nil') causes fallthrough to the repo config's ignore_paths. This test verifies that repo-level ignore_paths takes effect in this scenario. Signed-off-by: Rui Chen <rui@chenrui.dev>
The plan path in getMergedProjectCfgs only applies ignore_paths when autoDiscoverModeEnabled is true. Without the same gate on the apply path, explicitly planned dirs matching ignore_paths would be silently dropped during apply-all. Signed-off-by: Rui Chen <rui@chenrui.dev>
PendingPlan doesn't track whether a plan was auto-discovered or explicitly requested. If a user explicitly plans in an ignored path and runs apply-all, the plan is filtered out. Workaround: use 'apply -d <dir>'. Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Rui Chen <rui@chenrui.dev>
chenrui333
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes apply-all handling for pending plan files in paths covered by
autodiscover.ignore_paths.When Atlantis discovers unapplied
.tfplanfiles for a plainatlantis apply, it now filters ignored autodiscovery paths so stale or copied plan files under ignored directories are not applied. The filtering is limited to autodiscovery behavior and preserves real pending plans that Atlantis already recorded in pull status, including explicitatlantis plan -d <dir>runs under an ignored path.Notes
parseRepoCfg.