Question

Difficulty: MediumDeploying Infrastructure using Deployment Manager or Terraform

A Cloud Engineer is using Google Cloud Deployment Manager to deploy infrastructure resources into a newly created target Google Cloud project named `prod-analytics-net`. During the execution of `gcloud deployment-manager deployments create`, the deployment fails because the required Compute Engine API has not been activated. How should the engineer resolve this failure?

  1. Enable the Compute Engine API in the target project `prod-analytics-net` before running the deployment command again.Answer
  2. B
    Enable the Compute Engine API at the Organization node level so that all current and future target projects inherit API activation.
  3. C
    Generate and download a long-lived service account JSON key file with Editor permissions to bypass target project API enablement checks.
  4. D
    Re-run the deployment command with the `--region=global` flag to override project-level API dependency checks.

Answer

Enable the Compute Engine API directly within the target project `prod-analytics-net` before executing the deployment.
Enabling the Compute Engine API directly within the target project ensures that Google Cloud accepts API calls to provision resources. Infrastructure as Code tools like Deployment Manager or Terraform require target service APIs to be active in the target project before resource creation can begin.

Step-by-Step Solution

1
Identify the target project where infrastructure resources are being provisioned by Deployment Manager.
The target project is identified as `prod-analytics-net`.
Google Cloud resource deployment requires that target service APIs are enabled within the project where resources reside.
2
Enable the required Compute Engine API (`compute.googleapis.com`) in the target project.
The target project gains permission to interact with and provision Compute Engine resources.
Deployment Manager cannot make API calls to provision resources if the service API is disabled in that project.
3
Re-execute the `gcloud deployment-manager deployments create` command.
The deployment succeeds as Deployment Manager can now invoke Compute Engine resources in `prod-analytics-net`.
With API enablement complete, Deployment Manager has valid endpoints to execute resource creation.

Key Concept

Project-Level API Enablement for Infrastructure Deployment
Estimated Time:1m 30s
Rate this question