How do I manage drift detection? Requirements, scheduling at scale, and why it doesn't run

Last updated: November 25, 2026

Drift detection runs a proposed run on a schedule to find differences between your code and your real infrastructure. If you turn on Reconcile, Spacelift then starts a tracked run, which applies your code to bring the infrastructure back in line.

Requirements
  • The Business plan or above (or the legacy Starter+ plan).

  • A private worker pool. Drift detection doesn't run on public workers.

Setting it up

Open the stack, go to Scheduling → Create schedule → Drift detection, and add one or more cron expressions and a timezone (UTC by default). Then choose:

  • Reconcile: when drift is detected, start a tracked run to fix it. Reconciliation follows the stack's autodeploy setting and plan policies. It isn't triggered if the stack's head commit changed during the drift run. If the drift detection run fails, a reconciliation run is triggered anyway.

  • Ignore state: run drift detection on stacks in any final state.

You can also use the spacelift_drift_detection Terraform resource.

Why drift detection didn't run
  • The stack isn't Finished, and Ignore state is off.

  • A run is in progress or waiting in Unconfirmed. Drift detection doesn't run then, even with Ignore state on.

  • The stack is on a public worker pool.

  • The worker pool's drift detection limit was reached. Runs over the limit are skipped until running ones finish.

  • Drift detection is disabled on the worker pool. The run is created as failed, with a note explaining why.

To find drift runs, open Runs and filter by Drift Detection: true. Drifted resources also appear in the Resources view.

Running drift detection on many stacks

Drift runs use workers like any other run, so starting many at once creates long queues.

  • Set limits on the worker pool. In the worker pool's form, enable Configure drift detection run limits to cap concurrent drift runs, or to disable drift detection on that pool.

  • Prioritise. Start with stacks where drift matters most: security- or compliance-sensitive stacks, stacks where drift could cause outages or costs, and stacks that are rarely applied.

  • Tune the frequency. Check production and compliance stacks more often, for example hourly, and stable or development stacks daily or less often.

  • Stagger the schedules. If every stack uses the same cron expression, they all start at once. Randomise the minute instead:

# Assumes the stack is defined in the same configuration as spacelift_stack.this
resource "random_integer" "drift_minute" {
  min  = 0
  max  = 59
  seed = spacelift_stack.this.id
}

resource "spacelift_drift_detection" "this" {
  stack_id = spacelift_stack.this.id
  schedule = ["${random_integer.drift_minute.result} */6 * * *"]
}

The seed keeps each stack's minute the same between applies.

Policies and alerts
  • In plan and trigger policies, drift runs have drift_detection set to true in the run input. For example, a plan policy can return a warning for drift runs, so someone reviews them before reconciling.

  • Drift runs also trigger webhooks, marked with the driftDetection field, so you can alert on them.

Sources