GoogleCloudPlatform/emblem

Bug: data ref `data.google_cloud_run_service.content_api` causing `setup.sh` build failure

pattishin opened this issue · 1 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: This repository is dedicated to a sample application that uses multiple Google Cloud products. We will only be able to address issues related to this application, not to underlying issues in a client library or one of the products. Please visit the Support page to reach the most relevant engineers.

Problem

Running through setup.sh script with brand new GCP projects for prod, staging, and ops projects produces the following failure from terraform/environments/ops/main.tf:

Step #2 - "tf plan": │ Error: Error when reading or editing CloudRunService "locations/us-central1/namespaces/thinking-armor-prod/services/content-api": googleapi: Error 403: Cloud Run Admin API has not been used in project 157914570064 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/run.googleapis.com/overview?project=157914570064 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Step #2 - "tf plan": │ Details:
Step #2 - "tf plan": │ [
Step #2 - "tf plan": │   {
Step #2 - "tf plan": │     "@type": "type.googleapis.com/google.rpc.Help",
Step #2 - "tf plan": │     "links": [
Step #2 - "tf plan": │       {
Step #2 - "tf plan": │         "description": "Google developers console API activation",
Step #2 - "tf plan": │         "url": "https://console.developers.google.com/apis/api/run.googleapis.com/overview?project=157914570064"
Step #2 - "tf plan": │       }
Step #2 - "tf plan": │     ]
Step #2 - "tf plan": │   },
Step #2 - "tf plan": │   {
Step #2 - "tf plan": │     "@type": "type.googleapis.com/google.rpc.ErrorInfo",
Step #2 - "tf plan": │     "domain": "googleapis.com",
Step #2 - "tf plan": │     "metadata": {
Step #2 - "tf plan": │       "consumer": "projects/157914570064",
Step #2 - "tf plan": │       "service": "run.googleapis.com"
Step #2 - "tf plan": │     },
Step #2 - "tf plan": │     "reason": "SERVICE_DISABLED"
Step #2 - "tf plan": │   }
Step #2 - "tf plan": │ ]
Step #2 - "tf plan": │ 
Step #2 - "tf plan": │   with data.google_cloud_run_service.content_api,
Step #2 - "tf plan": │   on main.tf line 13, in data "google_cloud_run_service" "content_api":
Step #2 - "tf plan": │   13: data "google_cloud_run_service" "content_api" {
Step #2 - "tf plan": │ 
Step #2 - "tf plan": ╵

Steps to Reproduce

Steps to reproduce the behavior:

  1. Simply follow the README, create 3 separate GCP projects for prod, staging, ops.
  2. Ensure you've retrieved the latest from the root, execute ./setup.sh

Expected behavior

Successful deployment of staging/prod Cloud Run services.

Screenshots

Screenshot 2023-01-06 at 10 37 07 AM

User environment:

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari] n/a
  • Emblem Project Version [e.g. v0.5.3] 0.6.0
ace-n commented

We need to enable the run.googleapis.com API.

We can do that in bootstrap.sh or in the ops module.

We should try doing that in the ops module first (since [IIRC] we tend to prefer config lives in Terraform). If that fails, we can move it to bootstrap.sh.