CoursesAtlantisIntermediate

Autoplan & change detection

Plan only what changed.

Advanced12 min · lesson 7 of 12

Autoplan is what makes Atlantis feel automatic: when a PR is opened or updated, Atlantis figures out which projects were affected and plans exactly those, posting a plan per project. The when_modified patterns in atlantis.yaml drive this — a project re-plans when its own files change, and when files it depends on (a shared module) change. Get these patterns right and a PR plans precisely the blast radius of its change, no more.

atlantis.yaml
projects:
- name: app
dir: live/prod/app
autoplan:
enabled: true
when_modified:
- "*.tf"
- "*.tfvars"
- "../../../modules/app/**/*.tf" # re-plan if the shared module changes

Change detection at scale

In a large monorepo, planning everything on every PR is slow and noisy, so accurate change detection is essential — it keeps a one-line change from triggering fifty plans. The when_modified globs are your tuning knob; include the shared code a project genuinely depends on so a module bump re-plans its consumers, but scope them tightly so unrelated changes do not fan out. You can also disable autoplan for a project and require an explicit atlantis plan when appropriate.

Missing dependency globs = a change that never gets planned
If a project depends on a shared module but its when_modified does not list that module’s path, a change to the module will not trigger the project’s plan — so the PR merges without ever showing that the change affects that project, and the drift surfaces later. Map dependencies accurately in when_modified; an incomplete pattern is a silently unplanned change, which is worse than a noisy over-plan.