Question

Difficulty: MediumDeploying Infrastructure using Deployment Manager or Terraform

An enterprise cloud team is creating reusable Google Cloud Deployment Manager templates (`storage_bucket.jinja`) to standardize Cloud Storage bucket deployments across multiple projects. The team wants to enforce parameter validation—such as requiring the `storage_class` input parameter and verifying allowed string values—so that invalid configuration files fail prior to resource creation. Which approach correctly implements this pre-deployment parameter validation in Deployment Manager?

  1. Create a companion schema file named `storage_bucket.jinja.schema` that defines mandatory properties and allowed values using JSON Schema.Answer
  2. B
    Append the `--validate-schema` flag to the `gcloud deployment-manager deployments create` command during deployment execution.
  3. C
    Set `enforce_uniform_bucket_level_access = true` inside the properties block of the top-level YAML configuration file.
  4. D
    Enable the Cloud Resource Manager API in the parent Google Cloud Organization resource node.

Answer

Create a companion schema file named `storage_bucket.jinja.schema` that defines mandatory properties and allowed values using JSON Schema.
In Google Cloud Deployment Manager, schema files (`.schema`) written in JSON Schema format allow authors to define rules for template properties. By creating `storage_bucket.jinja.schema`, Deployment Manager validates that required fields (such as `storage_class`) are present and conform to specified constraints before applying the deployment.

Step-by-Step Solution

1
Identify the Deployment Manager requirement for template parameter validation.
Deployment Manager allows developers to define input rules for Jinja2 or Python templates.
Validation ensures invalid inputs are caught before API calls are made.
2
Match the requirement to the standard Deployment Manager schema contract.
A `.schema` file written in JSON Schema format matching the template name enforces required fields, types, and allowed values.
Deployment Manager automatically loads and checks `.schema` files alongside template imports.

Key Concept

Deployment Manager Schema Validation
Rate this question