Back to blog

Blog

What Is Architecture Drift? 3 Layers and How to Catch Them

What is architecture drift? The gap between the design you approved and what actually runs. Learn its 3 layers and how to detect each before an incident does.

what is architecture driftUpdated 11/29/2026Shafi Khan

What Is Architecture Drift? 3 Layers and How to Catch Them

Architecture drift is the gap between the architecture you approved and the system that's actually running. The diagram says the API talks to the database through a service layer. The code says three controllers query it directly, and production says someone added a public subnet "temporarily" last spring.

TL;DR: architecture drift happens in three layers (code structure, infrastructure and documentation), and each one needs its own detection method. Code drift gets caught with architecture tests in CI, infrastructure drift with IaC drift checks, and documentation drift by comparing the real topology against the approved design on a schedule. You don't need to stop all drift. You need to stop unnoticed drift.

Below: a working definition, how it differs from configuration drift, the commands and tests that catch each layer, and a prevention checklist you can steal.

What is architecture drift, really?

The term goes back further than cloud. In their 1992 paper Foundations for the Study of Software Architecture, Dewayne Perry and Alexander Wolf separated two failure modes:

  • Architectural drift: the implementation becomes insensitive to the architecture. Changes are made without regard to the design, so the design slowly stops explaining the system.
  • Architectural erosion: the implementation actively violates the architecture. Rules the design depends on get broken.

In 2026 practice, people mostly say "drift" for both, and that's fine. The useful idea is that there are two descriptions of your system:

  1. Intent: the approved design, the diagrams, the ADRs, the Terraform modules as they were reviewed.
  2. Reality: the code on main, the resources in your AWS, Azure or GCP accounts, the traffic paths that actually exist.

Architecture drift is the delta between them. It almost never comes from one bad decision. It comes from fifty reasonable ones: a hotfix that skipped the service layer, a console change during an incident, a new queue nobody added to the diagram. Each one is defensible. Together they make the diagram nobody updated since 2023 a liability instead of an asset.

Why it matters:

  • Reviews go wrong. Security and cost reviews run against the diagram, not the system. If the diagram is fiction, the review is too.
  • Incidents take longer. On-call engineers trust the architecture docs at 3am. Drift sends them down the wrong path.
  • Changes get scary. When nobody knows the real dependency graph, every change feels risky, so teams slow down.

→ See where deployed reality has diverged from intent with Drift Detector

Architecture drift vs configuration drift

These get mixed up constantly, so let's be precise. Configuration drift (or infrastructure drift) means a deployed resource no longer matches its IaC definition. It's a real problem with great tooling, and we covered it in depth in Terraform drift detection.

Architecture drift is wider. Configuration drift is one of its inputs, not a synonym.

LayerWhat driftsSource of truthHow you catch it
Code structureDependencies, layering, module boundariesArchitecture rules, ADRsArchitecture tests in CI (e.g. ArchUnit)
Infrastructure configResource properties changed outside IaCTerraform state, CloudFormation templatesterraform plan -refresh-only, CloudFormation drift detection
Policy and postureSettings that break your standardsPolicy definitionsAWS Config rules, policy-as-code checks
Unmanaged resourcesThings created outside IaC entirelyCloud inventoryInventory and audit-log review
Design and docsDiagrams and docs that no longer matchApproved architectureComparing current topology with the approved design

Two takeaways from that table. First, no single tool covers every row. Second, the bottom row is the one almost every team skips, and it's the one reviewers actually read.

→ Compare architecture versions instead of eyeballing diagrams with Architecture Diff

The three layers of architecture drift

1. Code drift: when the layers stop being layers

Code drift is erosion in the Perry and Wolf sense. Classic symptoms:

  • A controller imports a repository class directly, skipping the service layer.
  • A "shared" utility package quietly becomes the place where everything depends on everything.
  • Two services that were meant to be independent now share a database table.

None of these break a build. All of them change the architecture.

2. Infrastructure drift: when the cloud disagrees with the code

This is the console change, the emergency security group rule, the instance resized by hand. It also includes resources that never entered IaC at all, which IaC tools can't see because they only check what they manage. That blind spot is why a cloud inventory matters as much as a drift job.

3. Documentation drift: when the diagram becomes fan fiction

Even if code and infrastructure match their sources, the design can drift: a new dependency on a third-party API, a cache added in front of the database, a second region. All perfectly codified, none of it on the diagram. If your docs are the weak spot, our guide on how to document software architecture covers keeping docs tied to the system instead of to someone's memory.

→ Connect repository structure to architecture review with Code Analysis

Architecture drift detection, layer by layer

Architecture drift detection works best when each layer is checked against its own source of truth, automatically, on a schedule. Here's what that looks like in practice.

Detect code drift with architecture fitness functions

An architecture fitness function is an automated check that your system still has a property you care about. For code structure, that means architecture tests that fail the build when a rule is broken.

ArchUnit describes itself as "a free, simple and extensible library for checking the architecture of your Java code." A layered-architecture rule from its user guide looks like this:

layeredArchitecture()
    .consideringAllDependencies()
    .layer("Controller").definedBy("..controller..")
    .layer("Service").definedBy("..service..")
    .layer("Persistence").definedBy("..persistence..")

    .whereLayer("Controller").mayNotBeAccessedByAnyLayer()
    .whereLayer("Service").mayOnlyBeAccessedByLayers("Controller")
    .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service")

And a targeted "this must never depend on that" rule:

noClasses().that().resideInAPackage("..source..")
    .should().dependOnClassesThat().resideInAPackage("..foo..")

Wire these into your normal test suite and the controller-imports-repository shortcut fails in the pull request instead of surviving for two years. Other ecosystems have similar dependency-rule tools. The principle matters more than the library: if an architectural rule only lives in a wiki, it isn't a rule.

Detect infrastructure drift with IaC tooling

For Terraform, terraform plan -refresh-only compares real resources with state without proposing changes. The full CI setup, exit codes and remediation options are in our Terraform drift detection guide, so we won't repeat them here.

For CloudFormation, drift detection is built in. Per the AWS drift detection docs, it detects whether "a stack's actual configuration differs, or has drifted, from its expected configuration." The CLI flow from the stack drift page:

# Start a drift check (returns a StackDriftDetectionId)
aws cloudformation detect-stack-drift --stack-name my-stack

# Poll until DetectionStatus is DETECTION_COMPLETE
aws cloudformation describe-stack-drift-detection-status \
  --stack-drift-detection-id <id-from-previous-step>

# List only the resources that changed or were deleted
aws cloudformation describe-stack-resource-drifts \
  --stack-name my-stack \
  --stack-resource-drift-status-filters MODIFIED DELETED

Know the limits before you trust a green result. AWS documents that CloudFormation:

  • Only checks resource types that support drift detection. Others come back NOT_CHECKED.
  • Only checks property values that are explicitly set in the template or via parameters, not defaults.
  • Doesn't check nested stacks when you run detection on the parent.
  • Checks the resources the stack manages, so something created entirely outside the stack won't show up.

That last point is the same blind spot as Terraform: IaC drift tools see managed resources only.

Detect policy drift with AWS Config

Some drift isn't "differs from the template" but "breaks our standards." AWS Config rules represent your ideal configuration settings, and AWS Config checks resource changes against them. Rules can trigger on configuration changes, periodically (for example every 24 hours) or both. Results come back as COMPLIANT, NON_COMPLIANT, ERROR or NOT_APPLICABLE. It's a solid net for things like public buckets or unencrypted volumes, regardless of how the resource was created.

Detect design drift by diffing intent against reality

This is the layer tools traditionally ignore. The approach:

  1. Keep the approved architecture as a versioned artifact, not a screenshot in a slide deck.
  2. On a schedule, build the current topology from real sources: IaC, cloud inventory, repositories.
  3. Compare the two and review the delta like a pull request: accept and update the design, or open a ticket to revert.

That's the workflow Architecto's Drift Detector is built around. It compares environments and IaC context so platform teams can see where architecture intent and deployed reality have diverged, across AWS, Azure, GCP, Kubernetes and Terraform-backed infrastructure. Pair it with ClickOps Detection when you need to know who changed something outside code.

→ Track drift across AWS, Azure, GCP and Kubernetes with Drift Detector

How to prevent architecture drift

Detection tells you drift happened. Prevention makes it rarer and cheaper. Here's the checklist we'd run on any team:

  • Write the rules down as code. Top 3 to 5 architectural rules (layering, forbidden dependencies, data ownership) exist as automated tests, not just wiki pages.
  • Put architecture in the PR template. Add one question: "Does this change the architecture? If yes, link the updated diagram or ADR."
  • Route infrastructure through IaC. Console access in production is break-glass, logged and followed by a codification ticket.
  • Run drift checks on a schedule. Daily or per-deploy checks, not only before audits.
  • Inventory beyond IaC. Something regularly lists resources that IaC doesn't manage.
  • Version the design. Diagrams and ADRs live next to the code or in a tool with version history, so you can diff them.
  • Review drift like a backlog. Every finding ends as "revert" or "accept and update the design." No third option called "ignore."
  • Recheck after incidents. Emergency fixes are the biggest drift source, so post-incident reviews include "what did we change outside the plan?"

If you want a structured version of the review questions, the architecture review checklist for cloud applications covers the full review, and the free builder below turns it into a checklist your team can reuse.

One opinion worth stating: accepting drift is fine. Sometimes production is right and the design was wrong. The failure isn't changing the system. It's changing the system and leaving the design behind.

→ Build a reusable review checklist with the free Architecture Review Checklist Builder

Key takeaways

  • Architecture drift is the gap between the approved design and what actually runs in code and in the cloud.
  • It's not just configuration drift. Config drift is one layer. Code structure and design docs drift too.
  • Each layer needs its own check: architecture tests for code, terraform plan -refresh-only or CloudFormation drift detection for infrastructure, AWS Config for policy, and a topology-versus-design comparison for the architecture itself.
  • IaC drift tools only see what they manage. Pair them with a cloud inventory.
  • Prevention is mostly process plus automation: rules as code, architecture questions in PRs, scheduled checks and a "revert or accept" decision for every finding.
  • For the Terraform-specific mechanics, read Terraform drift detection and the drift control explainer.

→ Start free and compare your real architecture with the one you approved

FAQ

What is architecture drift?

Architecture drift is the growing gap between the architecture a team intended (the approved design, diagrams and decision records) and the system that actually exists in code and in the cloud. It builds up through small, individually reasonable changes that nobody reflects back into the design.

What is the difference between architecture drift and configuration drift?

Configuration drift is narrower: a deployed resource no longer matches its infrastructure-as-code definition, for example a security group rule added in the console. Architecture drift covers that plus structural changes in code (new dependencies, broken layering) and documentation that no longer describes reality. Configuration drift is one input to architecture drift.

How do you detect architecture drift?

Check each layer against its own source of truth. Use architecture tests such as ArchUnit rules in CI for code structure, terraform plan -refresh-only or CloudFormation drift detection for infrastructure, AWS Config rules for policy, and a scheduled comparison of the current topology against the approved diagram for the design itself.

How do you prevent architecture drift?

Make the intended architecture executable and reviewable. Encode key rules as automated tests, route changes through infrastructure as code, update diagrams and decision records in the same pull request as the change, and run drift checks on a schedule rather than only during incidents or audits.

Is architecture drift always bad?

No. Some drift is the system teaching you something the original design missed. The problem is unacknowledged drift. When you find it, decide explicitly whether to revert the change or accept it and update the design, diagrams and decision records so they match.

→ See who changed what outside code with ClickOps Detection

Close the gap before the next incident does

Every team has drift. The ones that stay fast are the ones that see it early and decide on purpose. Put your rules in tests, keep IaC honest with scheduled checks, and keep a versioned design you can actually diff against reality.

Architecto brings that last part into one place: generate or import your architecture, then use Drift Detector to see where the real environment has wandered off and plan the fix while the design is still on screen.

→ Start free with Architecto and then open Drift Detector to check your first environment.

FAQ

Questions readers ask before they act on this page.

What is architecture drift?

Architecture drift is the growing gap between the architecture a team intended (the approved design, diagrams and decision records) and the system that actually exists in code and in the cloud. It builds up through small, individually reasonable changes that nobody reflects back into the design.

What is the difference between architecture drift and configuration drift?

Configuration drift is narrower: a deployed resource no longer matches its infrastructure-as-code definition, for example a security group rule added in the console. Architecture drift covers that plus structural changes in code (new dependencies, broken layering) and documentation that no longer describes reality. Configuration drift is one input to architecture drift.

How do you detect architecture drift?

Check each layer against its own source of truth. Use architecture tests such as ArchUnit rules in CI for code structure, terraform plan -refresh-only or CloudFormation drift detection for infrastructure, AWS Config rules for policy, and a scheduled comparison of the current topology against the approved diagram for the design itself.

How do you prevent architecture drift?

Make the intended architecture executable and reviewable. Encode key rules as automated tests, route changes through infrastructure as code, update diagrams and decision records in the same pull request as the change, and run drift checks on a schedule rather than only during incidents or audits.

Is architecture drift always bad?

No. Some drift is the system teaching you something the original design missed. The problem is unacknowledged drift. When you find it, decide explicitly whether to revert the change or accept it and update the design, diagrams and decision records so they match.

Related reading

Keep moving through the architecture workflow.