Infrastructure Drift
In one line
Infrastructure drift is when real infrastructure diverges from its config — manual changes create untracked differences.
In simple words
Infrastructure drift happens when the actual state of your infrastructure diverges from what is defined in your code (IaC). This occurs when someone makes manual changes — SSH into a server, manually change a security group — without updating the code.
Problems: inconsistency, unreproducibility, debugging difficulty, security risks. Prevention: immutable infrastructure, IaC only, drift detection (terraform plan), regular reconciliation.
Example
# Terraform plan shows drift
terraform plan
# ~ resource "aws_security_group" "web" {
# + ingress { cidr_blocks = ["0.0.0.0/0"] } # Someone opened this manually!
# }
# Fix: terraform apply (reverts) or update code if intentionalTerraform plan detects drift — actual state differs from code. Re-apply to revert the manual change, or update code if the change was intentional.
Common confusions
Confused with: Configuration Management
The difference: Configuration drift is the problem — untracked differences. Configuration management is a solution — tools that enforce a defined state, preventing drift. Drift is the disease; config management is the medicine.
Related terms
Related Resources
Related Lessons
- Infrastructure as Code
Drift detection.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.