Description
autodiscover.ignore_paths correctly filters projects during atlantis plan, but atlantis apply (without -p) still discovers and attempts to apply projects in ignored paths.
Steps to Reproduce
- Have a repo with modules sourced from a git repository (e.g.,
source = "git@github.com:org/modules.git//module-name?ref=abc123")
- The module repo contains subdirectories with
.tf files (e.g., test-deployment/main.tf) that are not actual deployable projects
- When Terraform downloads the module, the entire repo lands under
.terraform/modules/<name>/, including those extra directories
- Configure
atlantis.yaml with:
autodiscover:
mode: enabled
ignore_paths:
- ".terraform/**"
- Run
atlantis plan — correctly discovers only the intended projects
- Run
atlantis apply — discovers and attempts to apply the ignored paths, resulting in:
no plan found at path "project/.terraform/modules/some_module/test-deployment" and workspace "default"–did you run plan?
Expected Behavior
atlantis apply should respect ignore_paths and only attempt to apply projects that were not filtered out.
Actual Behavior
atlantis apply picks up terraform roots inside ignored paths and fails with "no plan found" errors. The summary check (atlantis/apply) reports failures even though all real projects applied successfully.
Root Cause
The plan and apply code paths diverge in how they discover projects:
- Plan path (
buildAllCommandsByCfg → getMergedProjectCfgs): calls isAutoDiscoverPathIgnored() to filter out ignored paths. Works correctly.
- Apply path (
buildAllProjectCommandsByPlan): uses PendingPlanFinder.Find() which scans the working directory for terraform roots via git ls-files. This path never checks ignore_paths.
The fix would be to add ignore_paths filtering inside buildAllProjectCommandsByPlan() after PendingPlanFinder.Find() returns results, similar to what getMergedProjectCfgs() does for plan.
Environment
Description
autodiscover.ignore_pathscorrectly filters projects duringatlantis plan, butatlantis apply(without-p) still discovers and attempts to apply projects in ignored paths.Steps to Reproduce
source = "git@github.com:org/modules.git//module-name?ref=abc123").tffiles (e.g.,test-deployment/main.tf) that are not actual deployable projects.terraform/modules/<name>/, including those extra directoriesatlantis.yamlwith:atlantis plan— correctly discovers only the intended projectsatlantis apply— discovers and attempts to apply the ignored paths, resulting in:Expected Behavior
atlantis applyshould respectignore_pathsand only attempt to apply projects that were not filtered out.Actual Behavior
atlantis applypicks up terraform roots inside ignored paths and fails with "no plan found" errors. The summary check (atlantis/apply) reports failures even though all real projects applied successfully.Root Cause
The plan and apply code paths diverge in how they discover projects:
buildAllCommandsByCfg→getMergedProjectCfgs): callsisAutoDiscoverPathIgnored()to filter out ignored paths. Works correctly.buildAllProjectCommandsByPlan): usesPendingPlanFinder.Find()which scans the working directory for terraform roots viagit ls-files. This path never checksignore_paths.The fix would be to add
ignore_pathsfiltering insidebuildAllProjectCommandsByPlan()afterPendingPlanFinder.Find()returns results, similar to whatgetMergedProjectCfgs()does for plan.Environment
ignore_pathsfeature introduced in v0.33.0 via feat: Add ignore path to autodiscover using glob #5267