Resource drift is the mismatch between infrastructure as declared in code and the actual state of resources in the cloud. In Terraform environments, drift often appears when someone changes a resource directly in AWS, leaving state, code, and reality out of alignment.
Expanded Definition
Resource drift is the divergence between the infrastructure your code says should exist and the infrastructure that actually exists at runtime. In cloud and infrastructure-as-code workflows, the term usually refers to managed resources such as networks, security groups, roles, storage, compute instances, and policy objects that were altered outside the declared configuration. The core issue is not the change itself, but the loss of a single trusted source of truth.
In practice, drift can be intentional, accidental, or the result of emergency troubleshooting, console edits, or delayed reconciliation. A common misunderstanding is to treat drift as only a Terraform problem. The broader security reality is that any declarative control plane can drift when operators bypass automation or when providers accept out-of-band changes. For that reason, the term belongs first to cloud and infrastructure governance, not to any one tool.
Where machine-access paths are involved, the boundary becomes more consequential. A resource that drifts out of policy may quietly widen access, weaken logging, or expose secrets-bearing services even when the code repository still looks compliant.
Examples and Use Cases
Resource drift appears in routine cloud operations long before it becomes a formal incident. The most useful examples are the ones that show how easily declared state and real state separate.
- An engineer changes an AWS security group in the console to open a port for troubleshooting, but the codebase still shows the stricter rule.
- A storage bucket policy is edited directly to grant temporary access, then never reverts back to the intended configuration.
- A load balancer, IAM role, or autoscaling setting is adjusted during an outage, creating an undocumented exception that future deployments inherit.
- A team runs Terraform apply against stale state, so later reviews compare code to the wrong baseline and miss the actual runtime change.
- A cloud platform adds a managed update that alters default resource behaviour, and the declared configuration no longer matches what is enforced in production.
These situations illustrate the main trade-off: faster operational fixes can reduce immediate downtime, but they also create hidden configuration debt. A drifted environment may still function, which is exactly why the problem is often missed until audit, outage recovery, or access review.
Security Implications
Resource drift matters because security controls are often encoded as resource properties, not just as policy documents. When the deployed state diverges from the approved state, organisations can lose the guarantees they believed were already enforced. That can affect exposure boundaries, logging settings, network segmentation, retention rules, encryption flags, and privileged access paths.
The most serious consequence is false confidence. Security teams may believe a control is present because the repository or module still contains it, while the live environment has already changed. That creates gaps in detection and review, especially when changes happen outside deployment pipelines. Drift can also make incident response harder: responders must reconstruct the live state before they can trust any restoration plan.
Practitioners should pay attention when a cloud control is technically present in code but operationally absent in production. In cloud estates with many accounts, subscriptions, or regions, even small unmanaged deviations can scale into broad governance failure because the divergence is replicated across multiple resource types and teams.
Domain and Governance Relevance
Resource drift is a cloud governance issue first, but it becomes especially important where infrastructure state influences trust, access, or service boundaries. In identity-adjacent environments, drift can change who can reach a resource, which logs are preserved, or whether an automated control still behaves as intended. That is why drift often shows up in reviews of IAM policies, security groups, secret stores, and agent-facing integrations even when identity is not the primary subject.
For NHI-heavy environments, the practical concern is not that drift is an identity concept, but that drifting infrastructure can silently alter the controls around machine-accessed services. A service endpoint, token backend, or execution environment may remain in place while the protections around it no longer match the approved design.
NHIMG treats drift as a governance signal: if the runtime estate can change without a corresponding update to declared state, the organisation no longer has a reliable basis for assurance, auditability, or controlled change management.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8 and NIST CSF 2.0 set the technical controls, while DORA define the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | 4 — Secure Configuration of Enterprise Assets and Software | Resource drift is a configuration divergence problem. |
| Recommendation — Enforce secure baselines and detect unauthorized configuration changes in cloud resources. | ||
| NIST CSF 2.0 | PR.IP-1 — Baselines and Configuration Management | Drift breaks the baseline that declared infrastructure depends on. |
| DE.CM-8 — Vulnerability and Configuration Monitoring | Drift is often discovered through continuous configuration monitoring. | |
| RC.RP-1 — Recovery Plan Execution | Drift complicates restoration because the real state must be known first. | |
| Recommendation — Maintain and monitor approved baselines so live resources stay aligned with declared state. Continuously monitor cloud resources for unauthorized or unintended configuration changes. Use validated runtime state before executing restoration and rollback actions. | ||
| DORA | ICT risk management framework — ICT risk management framework | Drift creates operational and governance gaps in controlled ICT environments. |
| Recommendation — Keep ICT change controls and monitoring strong enough to prevent unmanaged state divergence. | ||
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 9, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org