Terraform GCP "Error 403: quotaExceeded" in CI
GCP enforces per-project, per-region quotas. The google provider got a 403 with reason quotaExceeded because creating the resource would exceed an allotted limit (CPUs, IP addresses, instances).
What this error means
apply fails with "googleapi: Error 403: Quota ... exceeded" naming the metric and limit. It is a quota condition, not authentication -- the request reached GCP and was refused for capacity reasons.
Error: Error creating instance: googleapi: Error 403: Quota 'CPUS' exceeded.
Limit: 24.0 in region us-central1., quotaExceeded
with google_compute_instance.app,
on main.tf line 1, in resource "google_compute_instance" "app":Common causes
Project at a regional quota
The project already uses its allotted CPUs/IPs/instances in the region, so the new resource exceeds the limit.
Leaked resources from failed runs
Orphaned instances or addresses from earlier failures consume quota the current apply needs.
How to fix it
Request a quota increase or free capacity
Raise the quota in the console/CLI, or release unused resources before retrying.
# inspect current usage/limits
gcloud compute regions describe us-central1 \
--format="table(quotas.metric, quotas.usage, quotas.limit)"
# then request an increase via the Quotas page or:
# gcloud alpha services quota update ...Reduce footprint
- Clean up orphaned instances/addresses from failed runs.
- Use smaller machine types or fewer replicas where possible.
- Spread workloads across regions if one is saturated.
How to prevent it
- Track GCP quotas and request increases ahead of need.
- Clean up orphaned resources from failed applies.
- Right-size machine types to stay within CPU quotas.