Cloud Advanced
Terraform Drift Detection¶
TerraformDriftReconciliationGitOps 5 min read
Drift detection, terraform plan -refresh-only, prevention and remediation.
What is Drift¶
Difference between desired vs actual state. Causes: manual changes, auto-scaling, other tooling.
Detection¶
terraform plan -refresh-only -detailed-exitcode
# Exit 0 = no drift, Exit 2 = drift detected
# Scheduled CI check
on:
schedule:
- cron: '0 8 * * 1-5'
Prevention¶
- SCPs/Azure Policy — block manual changes
- Read-only console — write only through CI/CD
- lifecycle ignore_changes for auto-managed attributes
Summary¶
Drift is inevitable. Scheduled plans + policies + review = solution.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.