Configuration drift can be defined as when infrastructure configurations diverge from IaC templates that are agreed on. Ways to limit drift include:
Frequent Re-Applications: Regularly run IaC templates using commands like terraform apply to ensure your infrastructure remains consistent with the agreed-upon configuration state.
Automated Drift Detection: Use tools like Terraform drift detection and AWS Config to monitor infrastructure state and then alert when infrastructure state doesn't match the expected state.
Scheduled Audits: Schedule regular audits that check the actual infrastructure against the IaC definitions to catch any drift and fix it right away.
CI/CD Integration: Infrastructure deployments can be automated using CI/CD pipelines, which reduce the risk of drift from a manual change in configuration.