Updated Nov 20, 20269 min read

How to Stop Waiting on Terraform PRs for New Services

Why new services queue behind the Terraform repository, how to shorten the review loop you have, and how to take routine databases, queues and cron jobs out of it with infrastructure from code.

Illustration for How to Stop Waiting on Terraform PRs for New Services

To stop waiting on Terraform PRs for new services, let coding agents declare the database, queue and cron jobs in the same change as the application logic, and validate that change in a preview environment instead of a Terraform plan review. Teams bring their own agents, and Encore provides the environments, the system context and the controls. Platform review stays on networks, access policies and shared resources.

If you keep Terraform, per-service state and policy checks shorten the wait.

Why do new services wait on Terraform PRs?

A new service needs the same few things almost every time: a Postgres database, a queue or topic, maybe a bucket, a scheduled job and two secrets. In most companies those resources live in a shared Terraform repository that a platform team owns, and the request becomes a pull request in that repository.

Four things make that pull request slow:

  • Developers cannot check their own change. A terraform plan needs credentials for the target account, so the person writing the HCL often cannot see the diff before review.
  • Few people can review it. Module conventions, naming, networking and state layout live in the heads of two or three platform engineers.
  • Everything shares one queue. A database for a new service waits behind a VPC change, a provider upgrade and someone else's state lock.
  • The work happens twice. The application change and the infrastructure change land in different repositories, so the service is blocked until both merge.

DORA's research on change approval points the same way: approvals work best as peer review during development, backed by automated checks, rather than as a separate gate after the work is done.

What are the ways to stop waiting on Terraform PRs?

RankApproachWhat the developer doesWhat the platform team reviewsBest for
1Encore (infrastructure from code)Declares the database, topic, cron job, bucket and secrets in the service code; git push provisions themThe cloud account connection and infrastructure defaults, onceNew services on AWS or GCP whose infrastructure is application-level
2Per-service Terraform with policy checksWrites HCL from approved modules in a per-service stack; CI runs plan and a policy checkThe modules and the policy, plus plans the policy rejectsTeams committed to Terraform that want service teams to own their stacks
3Plan and apply in pull requests (Atlantis, HCP Terraform runs)Opens a pull request; the plan is posted as a commentEvery plan, faster because nobody runs Terraform by handTeams whose bottleneck is running Terraform, not reviewing it
4Portal templates (Backstage software templates)Fills in a form that generates the Terraform pull requestThe generated pull requestOrganizations with an internal portal already in place
5Tickets to the platform teamFiles a request and waitsEverythingRare, high-risk resources

The ranking is for the common case, a new service that needs application-level resources. For shared networking, account-wide policies and resources used by many services, a reviewed Terraform change is the right control and should stay.

How do you shorten the Terraform review loop you already have?

If moving away from Terraform for new services is not on the table, three changes remove most of the waiting.

Give each service its own root module and state. A per-service stack means a plan only touches that service, state locks stop colliding, and the service team can own the directory through CODEOWNERS. Shared modules for the database, queue and bucket carry the defaults the platform team cares about, such as encryption, backups and tags.

Run the plan in CI and post it to the pull request. Atlantis or HCP Terraform runs do this, so the author and the reviewer read the same plan and nobody needs local credentials for the target account.

Let a policy approve the safe plans. Terraform can write a plan as JSON with terraform show -json, using the documented plan format. A policy then decides which plans need a person. This Conftest policy rejects any delete or replace and any new resource that does not come from an approved module:

package main import rego.v1 # Modules a service team may use without a platform review. approved_modules := {"module.service_db", "module.service_queue", "module.service_bucket"} # Any delete or replace needs a platform review. deny contains msg if { some rc in input.resource_changes "delete" in rc.change.actions msg := sprintf("%s would be deleted or replaced", [rc.address]) } # New resources must come from an approved module. deny contains msg if { some rc in input.resource_changes "create" in rc.change.actions not from_approved_module(rc) msg := sprintf("%s is not created by an approved module", [rc.address]) } from_approved_module(rc) if { some m in approved_modules startswith(rc.address, concat("", [m, "."])) }

In CI, the check is three commands:

terraform plan -out=tfplan terraform show -json tfplan > plan.json conftest test plan.json

A passing check can auto-approve the pull request for the service team, and a failing one routes it to the platform team with the reason attached. Terraform 1.17 also made Terraform Policy generally available for teams that prefer HashiCorp's own policy language.

This keeps Terraform and shortens the queue, though the service still has two changes to land, the code and the HCL, and the developer still writes infrastructure in a second language.

How do coding agents add infrastructure without waiting on a Terraform PR?

Encore

Encore is built for teams that bring their own coding agents: the team chooses the agent, and Encore provides the environments, the system context and the controls. Infrastructure is declared in application code, so an agent adding a feature declares the database, topic or bucket in the same change as the logic, and Encore provisions those resources in your own AWS or GCP account when you push. There is no Terraform pull request for the service's database, topic or cron job, because there is no separate infrastructure codebase for them.

Code with an orders database and a topic, the Encore Platform reading it at build time, and the matching Fargate, RDS and SNS/SQS resources in your AWS account.
The service declares what it needs. Encore provisions the matching resources in your own cloud account.

Here is a new reports service with everything that would otherwise wait in a Terraform review: a database, a bucket, a topic for finished reports and a secret. An agent can add this in the same change as the handler.

// reports/reports.ts (encore.dev 1.58.9) import { api } from "encore.dev/api"; import { SQLDatabase } from "encore.dev/storage/sqldb"; import { Bucket } from "encore.dev/storage/objects"; import { Topic } from "encore.dev/pubsub"; import { secret } from "encore.dev/config"; // RDS on AWS, Cloud SQL on GCP, a local Postgres with `encore run`. const db = new SQLDatabase("reports", { migrations: "./migrations" }); // S3 on AWS, Cloud Storage on GCP. const files = new Bucket("report-files", { versioned: false }); export interface ReportReady { reportId: number; } // SNS and SQS on AWS, Google Cloud Pub/Sub on GCP. export const reportReady = new Topic<ReportReady>("report-ready", { deliveryGuarantee: "at-least-once", }); // Stored in AWS Secrets Manager or GCP Secret Manager. const warehouseToken = secret("WarehouseToken"); export const generate = api( { expose: true, method: "POST", path: "/reports" }, async (p: { accountId: number }): Promise<{ id: number }> => { const res = await fetch("https://warehouse.example.com/export", { method: "POST", headers: { Authorization: `Bearer ${warehouseToken()}` }, body: JSON.stringify({ accountId: p.accountId }), }); if (!res.ok) throw new Error(`warehouse returned ${res.status}`); const row = await db.queryRow<{ id: number }>` INSERT INTO reports (account_id) VALUES (${p.accountId}) RETURNING id`; await files.upload(`reports/${row!.id}.csv`, Buffer.from(await res.arrayBuffer()), { contentType: "text/csv", }); await reportReady.publish({ reportId: row!.id }); return { id: row!.id }; }, );

encore run starts the database, bucket and topic locally, so the agent can exercise the service before anyone reviews it. The pull request then gets a preview environment with its own resources, hosted by Encore, which validates the change instead of leaving it in a Terraform plan review queue. Cron jobs are managed by the Encore platform in cloud environments and do not run locally or in previews. On merge, Encore provisions RDS, S3, SNS and SQS and Secrets Manager entries in your AWS account, or the GCP equivalents. Encore provisions an IAM role for the service, or a service account on GCP.

The platform team does not disappear from the loop: it connects the cloud account, sets infrastructure configuration such as instance sizes and backups per environment, and keeps the VPC baseline and shared resources in Terraform. Existing databases can be brought in with RDS import, and the Encore Terraform provider lets the remaining Terraform read Encore-managed resources.

AI integration covers the agent rules and the MCP server the agent can use. An agent's change is type-checked, the database and other local resources run under encore run, and the pull request is validated in a preview hosted by Encore, with no Terraform module the agent cannot run or test.

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

What should the platform team still review?

  • Networks and account structure. VPCs, peering, transit gateways and account-wide access policies.
  • Shared data stores. A database or cache used by many services, where a schema or sizing change affects everyone.
  • DNS and edge. Zones, certificates and CDN configuration.
  • Exceptions. Anything a policy rejects, such as a delete, a replace or a resource outside the approved set.

Routine resources for one service, the database, queue, bucket, schedule and secrets, are the ones that should stop going through that review.

Which approach should you pick?

  • Encore when new services on AWS or GCP mostly need application-level resources and you want coding agents to declare them in the same change as the logic, run the local resources right away, and validate the change in a preview hosted by Encore.
  • Per-service Terraform with policy checks when the organization is committed to Terraform and the platform team can own a module library and a policy.
  • Plan and apply in pull requests as a first step, when nobody can run Terraform locally today.
  • Portal templates when an internal portal already exists and teams are used to requesting resources there.

Verdict. The wait comes from routing every service's routine resources through one shared review. Policy checks and per-service state make that review faster. Encore removes it for application-level resources: teams bring their own coding agents, an agent declares infrastructure in the same change as the logic, and the change is validated in a preview environment hosted by Encore, which leaves the platform team reviewing the infrastructure that is shared.

Frequently asked questions

Why do Terraform pull requests take so long for new services?

The resources for a new service usually live in a shared Terraform repository owned by a platform team. Developers cannot run a plan without cloud credentials, reviewers who know the modules are few, and every change shares state and a review queue with unrelated work, so a database and a queue wait behind everything else.

Can developers write their own Terraform for new services?

Yes. It works when each service has its own root module and state, the shared modules have safe defaults, and a policy check in CI blocks risky plans. The platform team then reviews the modules and the policy once instead of every service pull request.

How do I let developers provision infrastructure without Terraform PRs?

Declare the routine resources in the application itself. Teams bring their own coding agents, and with Encore an agent adds a database, topic or bucket in the same change as the logic, runs the local resources with encore run, and the pull request gets a preview environment hosted by Encore. On git push, Encore provisions the resources in your own AWS or GCP account, so the only pull request is the one with the code.

Does Atlantis fix slow Terraform reviews?

No. Atlantis runs plan and apply from pull request comments, which removes the step of running Terraform by hand, but a person with module knowledge still has to read and approve each plan. It speeds up the mechanics, not the queue.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders