Infra-as-code changes with agents and plan gates
Infra-as-code agents can draft Terraform or Pulumi changes quickly. The non-negotiable gate is plan review before apply.
Infra-as-code agents can draft Terraform or Pulumi changes quickly. The non-negotiable gate is plan review before apply. Treat apply like a production deploy, because it is.
The trap is skipping the plan because the diff “looks small,” or letting an agent apply with admin credentials from a laptop shell. Wrong destroys and IAM expansions become outages.
Decide: let the agent draft, or stop before apply
Let the agent draft when:
- The infra intent and environments in scope (dev / stage / prod) are written down.
- It follows existing modules and providers; no casual new providers.
- Prod scope is forbidden unless a human explicitly requested it.
- Reviewers will see a stored plan artifact on the PR.
Do not apply when any of those are missing. Separate infra PRs from app feature PRs when a replace or destroy is possible.
The plan gate (what must exist before apply)

Plan Gate
Minimum contract for an infra change:
- Intent note: what should change, which workspace, what must not change.
- fmt / validate (or the Pulumi equivalent) green on the PR.
- Stored plan attached for reviewers: creates, updates, replaces, destroys.
- Human review focused on blast radius: destroys, replaces, public exposure, IAM expansions.
- Pipeline apply only, then smoke checks and dashboards with rollback or undo notes ready.
If you want one high-leverage guardrail, fail CI when the plan artifact is missing from the PR. Agents follow red builds.
Three traps that become outages

Failure modes to catch early
- Laptop apply. Admin creds in an agent-controlled shell, weak audit trail. Fix: pipeline only.
- Skip the plan. A “small” diff hides a destroy. Fix: attach plan every time; review destroys first.
- Mixed PRs. App feature plus risky replace in one change. Fix: separate infra PRs; roll back independently.
A short weekly hygiene loop
Once a week: review open infra PRs for missing plans, expire stale workspaces and leftover state experiments, and confirm prod apply still requires two humans (or your equivalent policy). Rehearse one undo path in a non-prod workspace so rollback is not theoretical.
Bottom line

When this fits vs when it does not
Agents are useful for drafting infra when humans own the plan gate. No stored plan, no apply. For secret handling around tooling, pair this with git history hygiene for agents so credentials never land in history either.
Share