Illustration of a review flow: a Terraform plan, a human review of intent, policy, and limits, then the apply to infrastructure.

AI-Generated Terraform Needs More Than a Clean Plan

A Terraform configuration can parse successfully and still describe the wrong infrastructure for the intended system. A successful plan doesn't establish that its permissions, capacity or dependencies are acceptable.

AI can write Terraform, while people remain accountable for the risk of applying it. That makes the review process central to whether generated infrastructure deserves our trust.

We need to connect the proposed change to its purpose, its constraints and the people who will maintain it. A clean plan provides evidence about a change. Architectural safety requires a wider judgement.

What a successful Terraform plan tells us

Syntax checks establish whether code follows the language's rules. Terraform validation adds checks for internal consistency, while planning works out proposed changes using configuration, state and information from providers.

Those checks serve different purposes. None establishes whether the architecture meets our business requirements, and a successful plan doesn't guarantee that an apply will succeed.

A permission can be valid and broader than a service needs. A resource replacement can follow directly from the configuration and still create an unacceptable interruption.

AI-generated Terraform belongs within this same distinction. We can treat it as a draft that deserves assessment on its merits, without assuming that its origin makes it inherently unsafe.

The missing context matters. If we haven't specified acceptable exposure, spending limits or recovery requirements, we can't infer those decisions from code that happens to work.

An eight-part review sequence

I'd use eight review areas to connect the intended outcome to the resulting infrastructure. Each area should produce evidence that the next reviewer can understand.

The sequence starts before generation and continues after apply. Teams can combine checks in one workflow, but each question still needs an answer.

1. Intent and specification

Before evaluating generated Terraform, we need a clear account of what the change should accomplish. Otherwise, we risk reviewing the implementation against assumptions that nobody has agreed.

A useful specification separates known requirements, assumptions and unresolved questions. It also states what the change must preserve, such as an existing access boundary or an acceptable recovery time.

The review should answer:

For EU-based teams, this includes any applicable requirements for data location, access and retention. Choosing a region alone doesn't settle the wider compliance question.

I recommend keeping this specification short enough to compare directly with the plan. Unresolved decisions that affect access, availability or data handling deserve explicit resolution before approval.

2. Least privilege

We need to review both the permissions that the infrastructure grants and the permissions that the deployment workflow uses. These are separate sources of risk.

An application identity should receive access appropriate to its task. The identity applying Terraform also needs a defined scope, rather than whatever access makes the generated configuration easiest to deploy.

Useful checks include:

Network access deserves the same attention. A service can have tightly scoped identity permissions while exposing an endpoint more broadly than intended.

Where broad permissions appear necessary, we should establish why and record who accepts that exposure. Convenience alone gives us little basis for judging the consequences.

3. Policy-as-code

Policy-as-code turns selected requirements into repeatable checks. It gives us a way to enforce boundaries consistently across generated and manually written configurations.

We can evaluate configuration and planned changes against rules for permitted locations, public exposure, encryption, resource types or required ownership information. The useful rules depend on the system's actual requirements.

The review should establish:

A passing policy result covers the rules we wrote and the information those rules could inspect. We still need judgement for requirements that those checks don't capture.

The deployment workflow should enforce blocking policies. If someone can bypass a failed check through another apply route, the policy offers a weaker boundary than the review may assume.

4. Cost and resource limits

A valid configuration can request more capacity than the intended workload needs. We should review the spending implications alongside technical capacity.

That means examining both the starting footprint and the conditions under which it can grow. Autoscaling settings, storage growth and resource counts deserve explicit limits where the architecture supports them.

Questions worth answering include:

Cost estimates help us compare choices, but usage and pricing assumptions affect their usefulness. We should record those assumptions rather than present an estimate as a guaranteed bill.

Budget alerts also serve a different purpose from enforceable limits. If we require a hard boundary, the review needs to identify the control that actually prevents further consumption.

5. State and plan review

The plan needs to make sense in the context of the infrastructure Terraform already manages. Reading generated files alone leaves out that relationship.

We should confirm the intended backend, workspace, account and environment before assessing changes. Then we can compare the plan with the specification and investigate anything that exceeds the expected scope.

The review should cover:

State and saved plan files also need appropriate protection because they can contain sensitive information. Access to those artefacts belongs within the review boundary.

A plan reflects the information available when Terraform creates it. We shouldn't treat an older plan as current evidence without considering intervening changes and whether we need a fresh review.

6. Human approval

Human approval should record a decision about an identifiable change. A general acknowledgement that the Terraform looks reasonable leaves too much uncertainty about what the reviewer accepted.

The approver needs enough context to connect the specification, plan, policy results and remaining risks. AI-generated explanations can assist that review, but they don't provide independent assurance.

Approval should establish:

For a small team, this doesn't require a large approval committee. It does require clarity about decision authority and any limits on independent review.

The depth of review should reflect potential impact and reversibility. A narrowly scoped change and a destructive change to a critical dependency warrant different levels of scrutiny.

7. Apply controls

The apply process should preserve the connection between what people reviewed and what Terraform executes. Otherwise, a sound review can lose relevance at the final step.

Where we use a saved plan, the workflow should apply that approved artefact. Changes to configuration or inputs require a new plan and appropriate approval.

The execution checks should answer:

State locking, where the backend supports it, helps control concurrent Terraform operations. We also need to account for infrastructure changes through other routes.

Recovery deserves preparation before execution. Reverting configuration doesn't necessarily restore deleted data or reverse every external effect, so the recovery approach must fit the resources at risk.

8. Post-change verification

A successful apply tells us Terraform completed its reported operations. We still need evidence that the resulting system behaves as intended.

Verification should return to the original specification. That keeps the review focused on outcomes and constraints, including effects on connected services and the people maintaining them.

Useful checks include:

We should define an observation period appropriate to the change. Some consequences appear immediately, while others depend on traffic, scheduled work or resource growth.

A named person should own those checks and any follow-up work. If verification exposes a problem, the team needs a clear decision path for containment, recovery or a corrective change.

Keeping the review workable for a smaller team

We can keep these eight areas in one change record with links to supporting evidence. Separate documents and approval layers add value only when they improve the decision or enforce a necessary boundary.

For a modest change, that record might contain a short specification, the plan, automated check results, an approval and verification evidence. Higher-impact work may need deeper dependency review, stronger separation of duties or a more detailed recovery procedure.

How much review is appropriate depends on data sensitivity, service criticality, reversibility, existing controls and team capacity. The answer to review depth is therefore: it depends.

Responsibility still remains with the people and controls governing the change. AI can help produce and explain Terraform, but our workflow must establish why the change should happen, who accepts its risks and how we'll confirm the outcome.

For the next AI-generated infrastructure change, who will accept that risk, and what evidence will they require before apply?