Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Race condition] artifactregistry.googleapis.com and compute.googleapis.com APIs do not finish initialization before GCP resource provisioning becomes #107

Open
bbhuston opened this issue Mar 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bbhuston
Copy link
Collaborator

bbhuston commented Mar 5, 2023

Problem: A race condition is causing terraform apply to fail on fresh GCP projects. Theartifactregistry.googleapis.com and compute.googleapis.com APIs do not finish initialization before Terraform attempts to provision additional GCP resource, which results in several 403 errors.

Fix: Directly leverage the Enable APIs GCP terraform module and depends_on statements to ensure that Terraform only attempts to provisions GCP resources once these resources can successfully be processed

Errors

│ Error: Error creating Repository: googleapi: Error 403: Artifact Registry API has not been used in project 762282637919 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/artifactregistry.googleapis.com/overview?project=762282637919 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.Help",
│     "links": [
│       {
│         "description": "Google developers console API activation",
│         "url": "https://console.developers.google.com/apis/api/artifactregistry.googleapis.com/overview?project=762282637919"
│       }
│     ]
│   },
│   {
│     "@type": "type.googleapis.com/google.rpc.ErrorInfo",
│     "domain": "googleapis.com",
│     "metadata": {
│       "consumer": "projects/762282637919",
│       "service": "artifactregistry.googleapis.com"
│     },
│     "reason": "SERVICE_DISABLED"
│   }
│ ]
│ 
│   with google_artifact_registry_repository.container_registry,
│   on artifact-registry.tf line 15, in resource "google_artifact_registry_repository" "container_registry":
│   15: resource "google_artifact_registry_repository" "container_registry" {
│ 

│ Error: Error creating Network: googleapi: Error 403: Compute Engine API has not been used in project 762282637919 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=762282637919 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
│ Details:
│ [
@bbhuston bbhuston added the bug Something isn't working label Mar 5, 2023
markmandel added a commit that referenced this issue Mar 6, 2023
Just adding `depends_on = [google_project_service.project]` so we can
wait for API's to be ready before moving forward.

Work on #107
markmandel added a commit that referenced this issue Mar 6, 2023
Just adding `depends_on = [google_project_service.project]` so we can
wait for API's to be ready before moving forward.

Work on #107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant