r/Terraform • u/Fickle_Excitement729 • 22h ago
Discussion Agent written Terraform PRs keep fighting manual changes in the console
We manage about 400 resources in Terraform across 3 AWS accounts. Agents write most of our infra PRs now, and they write them against the code, not against what's actually deployed.
Last month someone had raised an RDS instance size in the console during an incident and never put it back in code. Two weeks later an agent PR for an unrelated tag change went through, the plan showed the instance size going back down, it was one line in a 60 line plan, and nobody noticed. The database got resized during business hours.
coderabbit reviews the HCL and it's useful, it caught a hardcoded secret in a variable default last month. But drift between code and reality isn't in the diff, it's only in the plan, and long plans don't get read carefully.
What we're trying now:
- a scheduled drift check that opens an issue when real state differs from code
- failing CI if a plan modifies or replaces anything in our "do not touch" list
- posting a short plan summary at the top of the PR instead of the full output
How do you stop console changes and agent PRs from overwriting each other?