0
votes

I get the error below when I automatically create a new GCP project with various resources for example: Redis, SQL, GKE, etc... using Terraform code:

Error: error creating NodePool: googleapi: Error 403:
    (1) insufficient regional quota to satisfy request: resource "CPUS": request requires '35.0' and is short '24.0'. project has a quota of '24.0' with '24.0' available. View and manage quotas at https://console.cloud.google.com/iam-admin/quotas?usage=USED&project=<PROJECT_ID>
    (2) insufficient regional quota to satisfy request: resource "IN_USE_ADDRESSES": request requires '10.0' and is short '4.0'. project has a quota of '8.0' with '8.0' available. View and manage quotas at https://console.cloud.google.com/iam-admin/quotas?usage=USED&project=<PROJECT_ID>., forbidden

The Terraform code that I was trying to run:

resource "google_project" "my_project" {
  provider   = google-beta
  name       = "tf-test-project"
  project_id = "quota-123"
  org_id     = "123456789"
}

resource "google_service_usage_consumer_quota_override" "override" {
  provider       = google-beta
  project        = google_project.my_project.project_id
  service        = "compute.googleapis.com"
  metric         = "compute.googleapis.com%2Fcpus"
  limit          = "%2Fproject%2Fregion"
  override_value = "95"
  force          = true
}

The error I get after running the Terraform resource google_service_usage_consumer_quota_override.override

Error: Error creating ConsumerQuotaOverride: googleapi: Error 400: Precise override for limit with quota unit '1/{project}/{region}' on metric 'compute.googleapis.com/cpus' can't be applied in service: compute.googleapis.com.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.PreconditionFailure",
    "violations": [
      {
        "subject": "?error_code=101035\u0026quota_unit=1/%7Bproject%7D/%7Bregion%7D\u0026metric=compute.googleapis.com/cpus\u0026service=compute.googleapis.com",
        "type": "googleapis.com"
      }
    ]
  }
]
on quota.tf line 1, in resource "google_service_usage_consumer_quota_override" "override":
  1: resource "google_service_usage_consumer_quota_override" "override" {

I'd like to increase both GCP resources "CPUS" and "IN_USE_ADDRESSES" quotas using Terraform module for the new GCP project.

Is it possible?

Thanks!

https://www.terraform.io/docs/providers/google/r/service_usage_consumer_quota_override.html

1
Did you do any research before posing this question? cloud.google.com/docs/quotaJohn Hanley
I’m voting to close this question because this is a question about a vendor's billing policies.John Hanley
Of course I did some research before I posted this question. My question is not about a vendor's billing policies is about what am I doing wrong or what am I missing in the Terraform code?James
Please edit your question and include your research. This link might help you: stackoverflow.com/help/how-to-askJohn Hanley

1 Answers

2
votes

You are getting those errors because the values you are using are exceeding the quota limits.

Each quota limit has a default value for all consumers, set by the service owner. This default value can be changed by a quota override.

But a quota override cannot increase the available quota beyond what is allowed by the service default and any existing overrides by other parties (such as the service owner or an organization's quota administrator).

To increase available quota, use the Edit Quotas option on the main quota page or ask the org admin for a quota uplift.

You can check the quota information for a project using the Quota page:

GCP Navigation => IAM & admin => Quotas,

or through the following gcloud commands:

$ gcloud compute project-info describe --project project-name 
$ gcloud compute regions describe region-name

In your particular case 10 addresses were requested, and the deployment was short of 4 addresses because of the quota of 8 addresses. Same thing for the CPUs,35 CPUs were requested, and the limit of the quota is 24 CPUs.