A nightly drift job reports drift in the morning that disappears by itself in the afternoon.
AdvancedTroubleshootingLost, Corrupted and Drifted State
Answer
Likely causes → Scheduled automation changes resources (instance scheduler stopping dev EC2 at night, scaling schedules, Lambda rotating something), or eventual consistency in APIs read during refresh.
Diagnose → Correlate drift timestamps with CloudTrail events and EventBridge schedules:
aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=i-0abc123 \
--start-time 2026-11-08T00:00:00Z --max-results 20
Fix → ignore_changes on attributes owned by the automation, or move the drift job to a time when the environment is stable.
Prevent → Inventory every non-Terraform actor that writes to Terraform-managed resources and document ownership per attribute.
More on Lost, Corrupted and Drifted State
Someone deleted the state object from the S3 bucket. `terraform plan` now wants to create 140 resources that already exist.IntermediateState is gone and the bucket had no versioning. How do you recover a production stack?Advanced`Error: Failed to load state` followed by a JSON error like `invalid character '}' looking for beginning of object key string`.IntermediateThe plan prints `Note: Objects have changed outside of Terraform` and lists a security group with an extra ingress rule.BeginnerEvery plan wants to change `desired_capacity` on an Auto Scaling group back to 2, though autoscaling has raised it to 6.BeginnerA resource was deleted manually in the console. The plan wants to create it, and an apply fails because a dependent resource still references the old ID.Intermediate