
TL;DR
|
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.
Key takeaway: drift comes from changes made outside the normal process, and from updates that reach some systems but not others.
| Cause | Example |
|---|---|
| Manual changes | Someone logs into a server and changes a setting to fix an urgent problem |
| Undocumented emergency fixes | A hotfix in production that never makes it back into the configuration files |
| Uneven updates | Production gets a security patch, staging doesn't, or the other way around |
| Different setup over time | A server built last year and one built today, from slightly different instructions |
| Different tools per environment | Developers run a database version locally that production doesn't use |
| Automatic updates | Some systems update packages on their own schedule |
Key takeaway: drift breaks the promise that testing means something, and it turns outages into investigations.
| Problem | What happens |
|---|---|
| Failed releases | Code passes every test in staging, then fails in production because the two differ |
| Slower fixes | During an incident, nobody knows exactly how production is configured, so diagnosing the problem takes longer |
| Security gaps | Systems that missed a patch stay vulnerable, often unnoticed |
| Failed recovery | After a disaster, rebuilding from the documented configuration produces something that doesn't match what was running |
| Compliance problems | Auditors ask how systems are configured, and the answer doesn't match reality |
| Wasted time | Teams 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.
Key takeaway: make the configuration files the only source of truth, and make it hard to change systems any other way.
| Practice | How it prevents drift |
|---|---|
| Define configuration in files | Servers, services, and settings are described in files instead of set up by hand |
| Keep those files in Git | Every change is recorded, reviewed, and reversible |
| Build every environment from the same files | Staging and production can't quietly differ, because they come from the same definition |
| Pin versions | Name exact versions of runtimes and services, instead of "latest" |
| Make running systems read-only | Manual changes either aren't possible or don't survive the next deployment |
| Replace instead of repairing | Rebuild systems from the configuration rather than patching them in place |
| Detect drift | Regularly compare what's running with what the files say, and alert on differences |
This is the core idea of infrastructure as code.
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:
| Difference | Usually intentional? | How to manage it |
|---|---|---|
| Passwords, API keys, and other secrets | Yes | Set per environment as variables, never in shared files |
| Resource sizes | Often | Set per environment, and keep the software itself identical |
| Domain names | Yes | Set per environment |
| Software and service versions | No | Keep identical in every environment |
| Configuration settings | Rarely | Keep identical unless there's a documented reason |
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 risk | How Upsun Cloud handles it |
|---|---|
| Different service versions | Versions are pinned in the configuration, such as postgresql:17, and every environment built from it uses the same one |
| Staging that doesn't match production | Preview 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 servers | After 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 changes | Configuration changes go through Git, so they're recorded and can be reviewed like code |
| Intentional differences | Secrets 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.
When systems that should be configured the same, such as staging and production, gradually become different, usually through manual changes and uneven updates.
They overlap. Configuration drift is any difference between systems that should match. Environment drift usually means differences between development, staging, and production specifically.
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.
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.
Yes. Systems that missed updates or have untracked changes can be vulnerable without anyone knowing.
No. Different passwords, domain names, and resource sizes are often intentional. Drift is the unplanned, undocumented kind.