A Cloud Engineer is deploying a multi-tier application infrastructure containing Compute Engine instances and a Cloud SQL database into a newly created target project named `prod-data-project` using Google Cloud Deployment Manager. The deployment templates are maintained in a central repository and executed from a centralized CI/CD host project `ops-ci-project`. When executing `gcloud deployment-manager deployments create prod-stack --config=main.yaml --project=prod-data-project`, the deployment fails with an error indicating that the Cloud SQL Admin API (`sqladmin.googleapis.com`) is not enabled. Which action should the engineer take to resolve this issue?
- Enable the `sqladmin.googleapis.com` API inside the `prod-data-project` project.Answer
- BEnable the `sqladmin.googleapis.com` API inside the `ops-ci-project` host project.
- CGrant the primitive `roles/owner` role to the Google Deployment Manager service account in `ops-ci-project`.
- DAppend the `--auto-enable-apis` flag to the `gcloud deployment-manager deployments create` command.
Answer
Enable the Cloud SQL Admin API (`sqladmin.googleapis.com`) directly in the target project `prod-data-project` where the infrastructure resources are being instantiated.
When deploying infrastructure via Deployment Manager or Terraform across projects, Google Cloud service APIs must be enabled within the target project (`prod-data-project`) where the actual cloud resources (such as Cloud SQL) are created. Enabling the API in the target project grants Deployment Manager permission to manage that specific API's resources.
Step-by-Step Solution
Key Concept
API Enablement Scoping for Infrastructure as Code