How to Handle Terraform Drift in a Large AWS Environment?

July 27, 2025 3 answers
Asked by 3D_bezier
I've recently taken over a large AWS setup where Terraform is heavily utilized. The problem is, there have been manual changes and CI/CD pipelines continually making updates that aren't tracked in Terraform, leading to significant drift in the infrastructure. I'm looking for effective strategies to address and resolve this Terraform drift, especially on a large scale. Any advice would be greatly appreciated!

Answers

solventMix-A
Have you checked out driftctl by Trivy? It doesnโ€™t capture all resources, but it's a solid starting point. Also, if your Terraform resources arenโ€™t tagged, consider adding a global tag to help manage whatโ€™s out there better.

3D_bezier: Thanks for the tip! I'll definitely look into that.

Reply to this answer
~ask again tomorrow
Weโ€™ve been using Spacelift for drift detection. Itโ€™s a pretty handy tool! Just remember to only allow read access to the resources so you can reduce drift risks.
Reply to this answer
sieve.90mesh
One quick way to prevent further drift is to restrict user access to the AWS console and control plane APIs. This will help keep things in check moving forward. But first, youโ€™ll need to address the existing drift!

3D_bezier: Thatโ€™s a great point! I just need to know the best approach to actually fix the drift thatโ€™s already there.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions