-
Notifications
You must be signed in to change notification settings - Fork 1.3k
autodiscover.ignore_paths not respected during apply #6325
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
.tffiles (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.yamlwith: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): callsisAutoDiscoverPathIgnored()to filter out ignored paths. Works correctly. - Apply path (
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_paths filtering inside buildAllProjectCommandsByPlan() after PendingPlanFinder.Find() returns results, similar to what getMergedProjectCfgs() does for plan.
Environment
- Atlantis version: v0.33.0 (also confirmed by reading source through v0.40.0)
ignore_pathsfeature introduced in v0.33.0 via feat: Add ignore path to autodiscover using glob #5267
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working