12 Configuration Drift Tools for DevOps Teams

Compare 12 configuration drift tools: Terraform, OpenTofu, Pulumi, CloudFormation, AWS Config, Azure Policy, Argo CD, Flux, Ansible, Puppet and InSpec.

Dec 30, 2025 - 12:17
Nov 7, 2026 - 18:17
 0  186
12 Configuration Drift Tools for DevOps Teams

Configuration drift tools compare the state you declared (Terraform code, Kubernetes manifests, Ansible playbooks, policy rules) with what is actually running, and report or fix the difference. The main options are Terraform and HCP Terraform, OpenTofu, Pulumi, CloudFormation drift detection, AWS Config, Azure Policy, Argo CD, Flux, Ansible check mode, Puppet, Chef InSpec and Spacelift.

This guide groups twelve tools by the layer they watch: cloud infrastructure, Kubernetes, and servers. It is part of our infrastructure as code tools guide. If you want the concept first (what drift is and why it hurts stability), read the role of configuration drift detection. This page is about the tools and the commands you run.

Key takeaways

  • Drift is any gap between declared and real state. It usually comes from console changes, emergency hotfixes, scripts outside IaC, or another tool editing the same resource.
  • No single tool covers every layer. Most teams pair an IaC drift check for cloud resources with a GitOps controller for Kubernetes and a configuration manager for servers.
  • Detection is cheap; deciding what to do with the result is the hard part. Each finding needs an owner who either reverts the change or updates the code.
  • Scheduled checks (nightly terraform plan, AWS Config rules, Argo CD sync status) catch drift within hours instead of during the next release.
  • Auto-remediation fits Kubernetes well, because controllers already reconcile. For cloud infrastructure, start with alerts and review before you let a tool overwrite production.

Where configuration drift comes from

Drift rarely starts as a mistake. Someone opens a security group port during an incident, a vendor support engineer changes a database parameter, an autoscaler adds tags, or an old script still runs from cron. Each change makes sense in the moment. The problem shows up later when the next terraform apply silently reverts the fix, or when a staging test passes on an environment that no longer matches production.

Drift detection tools answer three questions: what changed, when, and who or what changed it. The best setups also answer a fourth: should the code change to match reality, or should reality be put back to match the code?

The 12 tools at a glance

ToolLayerHow it detects driftCan it auto-fix?
Terraform CLICloud / any providerterraform plan refreshes state and shows differencesYes, by running apply
HCP TerraformCloud / any providerScheduled health assessments for workspacesShows drift; you start a run to fix
OpenTofuCloud / any providertofu plan, same model as TerraformYes, by running apply
PulumiCloud / any providerpulumi refresh and pulumi previewYes, with pulumi up
AWS CloudFormationAWS stacksStack drift detection per resourceNo, reports only
AWS ConfigAWS accountRecords configuration changes and evaluates rulesYes, with remediation actions
Azure PolicyAzure subscriptionsCompliance evaluation against policy definitionsYes, with remediation tasks
Argo CDKubernetesCompares live objects to Git, marks apps OutOfSyncYes, with automated sync and self-heal
FluxKubernetesKustomization reconciliation on an intervalYes, reconciles by default
AnsibleServers, network devicesCheck mode with diffYes, by running the playbook
PuppetServersAgent runs compare catalog to node; noop mode reports onlyYes, enforces on each run
Chef InSpecServers, cloudCompliance tests against expected stateNo, tests only

Spacelift and env0 are also popular commercial platforms that run scheduled drift detection on top of Terraform and OpenTofu. They are covered in the platforms section below rather than counted in the twelve, because they wrap the same plan command.

Cloud infrastructure drift tools

1. Terraform CLI

The simplest drift check is a plan. Terraform refreshes its view of real resources, compares them with your configuration and state, and lists every difference. Two options make it suitable for automation. -refresh-only shows what changed outside Terraform without proposing changes to your code, and -detailed-exitcode returns exit code 2 when there are differences, so a pipeline can fail or alert.

# Nightly drift check in CI
terraform init -input=false
terraform plan -refresh-only -detailed-exitcode -input=false -no-color > drift.txt
status=$?
if [ "$status" -eq 2 ]; then
  echo "Drift detected"; cat drift.txt
  exit 1
fi

Exit code 0 means no changes, 1 means an error and 2 means changes are present. If the drift is a change you want to keep, update the code; if it is unwanted, run a normal plan and apply to put things back. Use terraform apply -refresh-only only when you want to accept the real values into state.

2. HCP Terraform (and Terraform Enterprise)

HCP Terraform adds health assessments, which run drift detection and continuous validation checks on a schedule for each workspace and show results in the UI and notifications. This removes the need to build your own nightly job, and it keeps the history in one place. Health assessments are a paid feature, so check the current plan details on HashiCorp's pricing page before you rely on them.

3. OpenTofu

OpenTofu is the Linux Foundation fork of Terraform, created after HashiCorp changed Terraform's licence in 2023. For drift, it behaves like Terraform: tofu plan -refresh-only -detailed-exitcode gives the same exit codes. Teams that moved to OpenTofu can keep the CI job above with the binary name changed.

4. Pulumi

Pulumi defines infrastructure in general-purpose languages such as TypeScript, Python and Go. pulumi refresh reads the real state of resources and updates the stack's state; pulumi preview then shows what pulumi up would change. Running pulumi preview --refresh in a schedule gives a drift report. Pulumi Cloud also offers drift detection as part of Pulumi Deployments.

pulumi login
pulumi stack select prod
pulumi preview --refresh --diff --expect-no-changes

--expect-no-changes makes the command fail when a change is found, which is what you want in a scheduled job.

5. AWS CloudFormation drift detection

If your AWS resources are deployed as CloudFormation stacks, the service can compare each supported resource's live properties with the template. It reports a status per resource (IN_SYNC, MODIFIED, DELETED, NOT_CHECKED) and shows the expected and actual values.

id=$(aws cloudformation detect-stack-drift --stack-name prod-network --query StackDriftDetectionId --output text)
aws cloudformation describe-stack-drift-detection-status --stack-drift-detection-id "$id"
aws cloudformation describe-stack-resource-drifts --stack-name prod-network \
  --stack-resource-drift-status-filters MODIFIED DELETED

Not every resource type supports drift detection, and the service only reports; it does not revert changes. The AWS docs list the supported types.

6. AWS Config

AWS Config records configuration changes to resources in an account and evaluates them against rules, either AWS managed rules or your own. It is useful for drift that IaC cannot see, such as resources created by hand that are not in any state file. Rules can trigger remediation through Systems Manager Automation documents, for example to re-enable S3 bucket encryption. Config also keeps a timeline of each resource, which helps you find when and how it changed.

7. Azure Policy

Azure Policy evaluates resources against policy definitions and reports compliance. Effects such as deny block non-compliant changes, audit reports them, and deployIfNotExists or modify can fix them through remediation tasks. It is the Azure counterpart to AWS Config rules and works well alongside Terraform or Bicep, catching manual portal changes between deployments.

Kubernetes drift tools

Kubernetes is built around controllers that reconcile desired and actual state, so GitOps tools extend that idea to the whole cluster configuration. Background reading: what GitOps is.

8. Argo CD

Argo CD compares the manifests in Git with the live objects in the cluster. When they differ, the application shows as OutOfSync, and the UI shows a diff. With automated sync and selfHeal enabled, Argo CD reverts manual changes made with kubectl edit. With prune, it also deletes objects that were removed from Git.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: payments
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/example/platform-config.git
    targetRevision: main
    path: apps/payments
  destination:
    server: https://kubernetes.default.svc
    namespace: payments
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

Fields that controllers change on purpose, such as replica counts managed by a HorizontalPodAutoscaler, should be listed under ignoreDifferences so they do not show as drift.

9. Flux

Flux runs Kustomization and HelmRelease objects that reconcile on an interval, so a manual change is overwritten at the next reconciliation. flux diff kustomization shows what would change before you merge, and flux get kustomizations shows readiness and the last applied revision. Flux is a CNCF graduated project, as is Argo CD.

Server and OS configuration drift tools

10. Ansible check mode

Ansible playbooks describe the desired state of hosts. Running them with --check --diff reports which tasks would change something, without changing anything. A scheduled check run is a cheap drift report for a server fleet or network devices.

ansible-playbook -i inventory/prod site.yml --check --diff --limit webservers

Tasks that use command or shell modules are skipped in check mode unless they set check_mode: false, so idempotent modules give better drift data. See our list of Ansible playbooks used in production for examples written that way.

11. Puppet

Puppet agents fetch a compiled catalog and enforce it on every run, by default every 30 minutes. Each run is a drift correction, and reports show which resources changed. If you want reports without changes, run the agent in noop mode (puppet agent --test --noop) or set noop for specific resources.

12. Chef InSpec

InSpec is a testing framework for infrastructure. You write controls that describe expected state (packages, ports, file permissions, cloud resource settings) and run them against hosts or cloud accounts. It does not change anything, which makes it a good independent check: the tool that applied the configuration is not the one grading it.

describe sshd_config do
  its('PermitRootLogin') { should cmp 'no' }
end

Platforms that schedule drift detection for you

Spacelift and env0 run Terraform, OpenTofu and other IaC tools as a managed service. Both offer scheduled drift detection that runs a proposed plan against each stack and can open a reconciliation run. They save you from writing cron jobs and storing plan output, and they add policies and approvals around the fix. Check each vendor's docs for which plans include it.

How to choose a drift stack

Your setupStart withAdd later
Terraform on AWSNightly terraform plan -detailed-exitcodeAWS Config for unmanaged resources
Terraform on AzureNightly planAzure Policy in audit mode
CloudFormation shopStack drift detection on a scheduleAWS Config rules
Kubernetes with GitOpsArgo CD or Flux with self-healignoreDifferences tuning, policy engine
VM fleetAnsible check mode or PuppetInSpec as an independent audit
Many teams, many stacksHCP Terraform, Spacelift or env0Central reporting and ownership rules

A drift workflow that works

  1. Run a detection job on a schedule for every environment, with results sent to the channel of the team that owns the stack.
  2. Classify each finding: expected (autoscaling, tags added by a platform), unauthorised, or an emergency fix that the code must absorb.
  3. For emergency fixes, open a pull request that updates the code, then re-run the plan to confirm it shows no changes.
  4. For unauthorised changes, revert through the normal pipeline and find out how the change was possible. Tighten IAM if people can change production by hand.
  5. Add ignore rules only for fields that really belong to another controller, and review them, because every ignore rule is a blind spot.

Ownership matters as much as tooling. Our post on who manages infrastructure drift in IaC projects covers how to split that responsibility.

Common mistakes

  • Running terraform apply on a schedule to "fix" drift. It will revert an emergency change made during an incident, possibly while the incident is still open.
  • Treating drift reports as noise. If a report always shows the same three expected differences, fix the code or the ignore rules so the report is empty when nothing is wrong.
  • Splitting one resource across two tools, for example a security group managed by Terraform and edited by a script. One tool should own each resource.
  • Only checking production. Drift between staging and production makes tests less trustworthy.

Learn the tools hands-on

Drift detection comes naturally once you are comfortable with state, plans and modules. Our Terraform training covers state management and CI pipelines, and the Ansible course covers idempotent playbooks and check mode. Both run in our Kharadi, Pune classroom and live online.

FAQ

What is configuration drift in DevOps?

It is the difference between the configuration you declared in code and what is actually running. Manual console edits, hotfixes, scripts and other tools that change the same resources are the usual causes.

How do I detect drift with Terraform?

Run terraform plan -refresh-only -detailed-exitcode. Exit code 2 means real resources differ from state. Run it on a schedule in CI and alert on that exit code.

Does AWS CloudFormation fix drift automatically?

No. CloudFormation drift detection reports which resources were modified or deleted and shows expected and actual values. You fix the drift by updating the stack or reverting the change.

Is Argo CD self-heal safe for production?

For most workloads, yes, as long as fields owned by other controllers, such as HPA-managed replicas, are excluded with ignoreDifferences. Self-heal means manual kubectl changes will be reverted, so incident fixes must go through Git.

What is the difference between AWS Config and Terraform drift detection?

Terraform only sees resources in its state. AWS Config records changes to all supported resources in the account and evaluates rules, so it also catches resources that were never in IaC.

Can Ansible detect configuration drift?

Yes. Run a playbook with --check --diff to see which tasks would change a host without changing it. Use idempotent modules, because command and shell tasks are skipped in check mode by default.

Should drift be fixed automatically?

Automatic fixing suits Kubernetes, where controllers reconcile constantly. For cloud infrastructure, alert first and review, because an automatic apply can undo an emergency fix.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.