Reputation: 697
As a beginner, I created a source code repository and wrote some basic terraform code, which is then to be executed by Cloud Build.
I created the Cloud Build from the console and configured it to trigger when there is a push to dev branch.
Once created, I attempted to trigger the job manually, by clicking RUN on console.
At this point I received an error from the console:
Failed to trigger build: unable to get call option credentials for cloud build robot: generic::permission_denied: error generating service identity: tenantmanager::123456: Consumer 1234567899 should enable service:cloudbuild.googleapis.com before generating a service account. com.google.api.tenant.error.TenantManagerException: Consumer 1234567899 should enable service:cloudbuild.googleapis.com before generating a service account.
Still trying to figure out how to go about this. Appreciate any pointers.
Thanks
Upvotes: 2
Views: 1400
Reputation: 697
In GCP, when we create a cloud project following APIs are enabled by default:
* BigQuery API
* BigQuery Storage API
* Cloud Datastore API
* Cloud Debugger API
* Cloud Logging API
* Cloud Monitoring API
* Cloud SQL
* Cloud Storage
* Cloud Storage API
* Cloud Trace API
* Google Cloud APIs
* Google Cloud Storage JSON API
* Service Management API
* Service Usage API
In order to utilize any service, not on the above list, we have to visit APIs and Services. For this example, visit Cloud Build API and click on Enable API.
Please refer to the documentation at this link.
Upvotes: 0
Reputation: 66
In general, You should enable cloud build API using the following command in CLI tool:
gcloud services enable cloudbuild.googleapis.com
You might want to consider adding cloud build account as a service account using the following command (replace variables with relevant values)
gcloud projects add-iam-policy-binding $PROJECT_ID --member="serviceAccount:${PROJECT_NUM}@cloudbuild.gserviceaccount.com" --role='roles/iam.serviceAccountUser'
There are many practices to follow (depends on what you trying to achieve), highly recommend you go through GCP documentation which is highly detailed, informative, and useful.
https://cloud.google.com/iam/docs/service-accounts and https://cloud.google.com/build/docs
Upvotes: 5