Prompt
How do I stop manual cloud changes from breaking IaC?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
To stop manual cloud changes from breaking Infrastructure as Code (IaC), the core goal is drift prevention + drift detection + controlled change paths.
1) Make IaC the only approved path
- Restrict console access for production where possible.
- Use RBAC / IAM so only a small set of people can make emergency manual changes.
- Prefer CI/CD pipelines with approvals over direct human edits.
2) Add policy guardrails
- Use tools like:
- AWS Config / SCPs
- Azure Policy
- GCP Org Policies
- OPA / Conftest / Terraform Cloud Sentinel
- Enforce rules such as:
- required tags
- approved instance types
- no public buckets
- mandatory encryption
- no security group changes outside IaC
3) Detect drift automatically
- Schedule drift checks:
- Terraform:
terraform planin CI,terraform refresh/drift detection, Terraform Cloud drift detection - CloudFormation: drift detection
- Pulumi: preview/refresh checks
- Terraform:
- Alert on drift via Slack/PagerDuty/email.
- Treat drift as an incident in prod.
4) Reconcile changes back into code
If a manual change was intentional:
- Update the IaC code to match the desired state
- Re-run the pipeline to apply it cleanly
- Avoid “keeping” manual changes only in the cloud
If it was accidental:
- Revert the cloud state by applying IaC again
5) Separate emergency fixes from permanent changes
Create an emergency change process:
- allow manual break-glass actions only for incidents
- require a follow-up ticket/PR within a short SLA
- post-incident, codify the change in IaC
6) Reduce blast radius with modular design
- Break infrastructure into smaller stacks/modules.
- Avoid huge monolithic states.
- Use clear ownership boundaries so one team’s manual change doesn’t break another team’s IaC.
7) Protect state and avoid partial ownership
- Make sure each resource has one source of truth.
- Avoid managing the same resource with both:
- IaC and
- ad hoc scripts / separate tools / manual ops
- Lock state where supported to prevent concurrent modifications.
8) Use read-only monitoring for humans
- Give most users read-only access to production.
- Provide dashboards and logs so they can inspect without changing resources.
9) Add CI checks before merge
- Validate:
- formatting
- linting
- policy checks
- plan output
- no unexpected replacements
- Require review for changes touching critical resources.
10) Educate teams on “drift hygiene”
- Document:
- “Do not click in the console for permanent changes”
- how to request infra changes
- how to handle incidents
- Make the preferred path faster than manual edits.
Practical baseline
If you want a simple starting point:
- Lock down console write access in prod
- Require all infra changes through PRs
- Run nightly drift detection
- Alert on drift
- Reconcile every drift into code or revert it
If you want, I can also give you:
- a Terraform-specific drift prevention checklist
- an AWS/Azure/GCP policy setup
- or a sample CI pipeline that blocks manual drift