• Docs
  • Talk to an expert
Blog
Blog
BlogProductCase studiesNewsInsights
Blog

What is configuration drift (and how do you stop it)?

configurationIaCinfrastructureGitOps
23 November 2026
Share

TL;DR

  • Configuration drift is when systems that are supposed to be the same, such as staging and production, or several servers, gradually become different.
  • It usually comes from small manual changes, emergency fixes that are never written down, and updates applied to some systems but not others.
  • Drift causes the classic "it worked in staging" failure, makes outages harder to fix, and leaves security gaps on systems that missed updates.
  • You stop it by defining configuration in files kept in Git, building every environment from them, and making manual changes impossible or temporary.
  • Some differences between environments are intentional, such as passwords and sizes. Keep those few, explicit, and documented.
  • On Upsun Cloud, one configuration file in Git builds every environment, so preview environments, staging, and production run the same software and services.

Configuration drift is the slow, usually unnoticed process by which systems that should be identical stop being identical. Staging gets a newer database version than production. One server gets a security patch and another doesn't. Someone fixes a production problem by hand and never writes it down.

Each change is small. Together, they mean your test environments no longer tell you what will happen in production. This guide explains where drift comes from, why it's costly, and how to stop it.

What causes configuration drift

Key takeaway: drift comes from changes made outside the normal process, and from updates that reach some systems but not others.

CauseExample
Manual changesSomeone logs into a server and changes a setting to fix an urgent problem
Undocumented emergency fixesA hotfix in production that never makes it back into the configuration files
Uneven updatesProduction gets a security patch, staging doesn't, or the other way around
Different setup over timeA server built last year and one built today, from slightly different instructions
Different tools per environmentDevelopers run a database version locally that production doesn't use
Automatic updatesSome systems update packages on their own schedule

Why configuration drift matters

Key takeaway: drift breaks the promise that testing means something, and it turns outages into investigations.

ProblemWhat happens
Failed releasesCode passes every test in staging, then fails in production because the two differ
Slower fixesDuring an incident, nobody knows exactly how production is configured, so diagnosing the problem takes longer
Security gapsSystems that missed a patch stay vulnerable, often unnoticed
Failed recoveryAfter a disaster, rebuilding from the documented configuration produces something that doesn't match what was running
Compliance problemsAuditors ask how systems are configured, and the answer doesn't match reality
Wasted timeTeams spend hours on bugs that only exist in one environment

Drift between development, staging, and production is often called environment drift. Our guide Dev, staging, and production environments explained explains why those environments need to match.

How to stop configuration drift

Key takeaway: make the configuration files the only source of truth, and make it hard to change systems any other way.

PracticeHow it prevents drift
Define configuration in filesServers, services, and settings are described in files instead of set up by hand
Keep those files in GitEvery change is recorded, reviewed, and reversible
Build every environment from the same filesStaging and production can't quietly differ, because they come from the same definition
Pin versionsName exact versions of runtimes and services, instead of "latest"
Make running systems read-onlyManual changes either aren't possible or don't survive the next deployment
Replace instead of repairingRebuild systems from the configuration rather than patching them in place
Detect driftRegularly compare what's running with what the files say, and alert on differences

This is the core idea of infrastructure as code.

Intentional differences

Key takeaway: some differences between environments are right. Keep them few, explicit, and outside the shared configuration.

Not every difference is drift. Production should have different passwords from staging, more computing resources, and its own domain name. The aim is to make those differences deliberate:

DifferenceUsually intentional?How to manage it
Passwords, API keys, and other secretsYesSet per environment as variables, never in shared files
Resource sizesOftenSet per environment, and keep the software itself identical
Domain namesYesSet per environment
Software and service versionsNoKeep identical in every environment
Configuration settingsRarelyKeep identical unless there's a documented reason

Configuration drift on Upsun Cloud

Key takeaway: on Upsun Cloud, one configuration file in Git builds every environment, so the software and services can't quietly differ between them.

On Upsun Cloud, your apps, services, and routes are defined in .upsun/config.yaml, which lives in Git alongside your code. Every environment is built from that file:

Drift riskHow Upsun Cloud handles it
Different service versionsVersions are pinned in the configuration, such as postgresql:17, and every environment built from it uses the same one
Staging that doesn't match productionPreview environments and staging are built from the same file as production, and by default a new environment starts with a copy of its parent's data
Manual changes on serversAfter the build, the app's file system is read-only, except for storage you've declared for files your app creates, so changes made by hand don't become part of the app
Undocumented changesConfiguration changes go through Git, so they're recorded and can be reviewed like code
Intentional differencesSecrets and environment-specific settings are set as variables per environment, and resources can be sized per environment

The result is that a preview environment for a pull request runs the same software and services as production, and by default a copy of its parent's data, so testing reflects what will actually happen when the change goes live.

For more on the costs of drift and how to tackle it, read Development environment drift: the hidden costs, the checklist for reducing environment drift, and Environment parity is a platform problem.

You can deploy on Upsun Cloud free for 15 days, with no card needed, or see how preview environments work on Upsun Cloud.

Frequently asked questions

What is configuration drift?

When systems that should be configured the same, such as staging and production, gradually become different, usually through manual changes and uneven updates.

What is the difference between configuration drift and environment drift?

They overlap. Configuration drift is any difference between systems that should match. Environment drift usually means differences between development, staging, and production specifically.

How do you detect configuration drift?

Compare what's actually running with what your configuration files say. Many infrastructure as code tools can show the differences, and some platforms rebuild environments from the files so the differences can't build up.

How do you prevent configuration drift?

Define configuration in files, keep them in Git, build every environment from them, pin versions, and make running systems read-only so manual changes don't stick.

Is configuration drift a security risk?

Yes. Systems that missed updates or have untracked changes can be vulnerable without anyone knowing.

Are all differences between environments drift?

No. Different passwords, domain names, and resource sizes are often intentional. Drift is the unplanned, undocumented kind.

Stay updated

Subscribe to our monthly newsletter for the latest updates and news.

Deploy possibility.
Try Upsun for free.

Build with DispatchDeploy on Cloud