A cloud engineer is using Terraform to automate the deployment of a Google Kubernetes Engine (GKE) cluster into a target service project named `proj-workloads-prod`. During the pipeline execution, `terraform apply` fails with an API error stating `Google API Error 403: Kubernetes Engine API has not been used in project proj-workloads-prod or it is disabled`. The engineer had previously enabled `container.googleapis.com` in the central CI/CD administrative project `proj-pipeline-host` where the deployment pipeline service account resides, assuming that API enablement in the calling project would suffice. Which action must the engineer take to resolve this failure?
- Enable `container.googleapis.com` specifically in the target project `proj-workloads-prod` where the infrastructure resources are being provisioned.Cevap
- BRe-enable `container.googleapis.com` in `proj-pipeline-host` and grant the Service Account User role to the target project's default compute engine service account.
- CExport a service account JSON key from `proj-workloads-prod` and supply it to the Terraform provider configuration in `proj-pipeline-host` to bypass project API restrictions.
- DModify the organization policy to enforce API inheritance so that `proj-workloads-prod` automatically inherits enabled APIs from the parent folder.
Cevap
Enable the Kubernetes Engine API (`container.googleapis.com`) specifically inside the target project where infrastructure resources are being deployed.
In Google Cloud, infrastructure service APIs (such as `container.googleapis.com`) must be explicitly enabled within the specific target project where the resources are created. Enabling the API in a caller's host project or pipeline administrative project only enables API usage for resources located in that host project.
Adım Adım Çözüm
Anahtar Kavram
API Enablement Location in Multi-Project Infrastructure Provisioning