Question

Difficulty: MediumImplementing Infrastructure as Code using Terraform and Deployment Manager

Your organization is establishing standardized Google Cloud Deployment Manager practices for provisioning cloud infrastructure across development environments. You need to create a reusable configuration and safely deploy it. In what order should you execute the steps to construct, validate, preview, and commit the deployment?

  1. 1Author the Jinja2 or Python template file defining the infrastructure layout alongside a corresponding .schema file to validate input parameters.
  2. 2Create the top-level YAML configuration file that imports the template and specifies the required runtime parameter values.
  3. 3Execute the deployment creation command with the --preview flag using the Cloud SDK to inspect the prospective resources without provisioning them.
  4. 4Execute the deployment update command using the Cloud SDK to finalize and provision the previewed infrastructure resources.

Answer

The correct sequence starts with authoring the Jinja2/Python template and schema file, followed by building the top-level YAML configuration file. Next, execute the deployment creation with the --preview flag to validate proposed changes without provisioning, and finally run the deployment update command to commit and instantiate the infrastructure.
The correct workflow for managing complex Cloud Deployment Manager configurations starts at authoring reusable Jinja2 or Python templates with schemas to validate input properties. Once templates exist, a top-level YAML configuration imports them and sets environment variables. Using the Cloud SDK with the preview flag renders the proposed graph without creating resources, allowing verification. Finally, updating the previewed deployment commits the configuration to provision resources in Google Cloud.

Step-by-Step Solution

1
Define reusable template and schema files.
Establishes parameterized resource logic and strict input validation rules.
Deployment Manager requires underlying template definitions and schema parameters to exist before top-level configurations can reference them.
2
Construct the main YAML configuration file.
Passes specific environment variables into the imported templates.
The YAML configuration acts as the entry point that binds input variables to the schema-validated templates.
3
Run `gcloud deployment-manager deployments create --config <config.yaml> --preview`.
Renders and displays the complete resource manifest in a preview state without making resource allocations.
Previewing ensures architectural correctness and prevents unintended infrastructure changes before provisioning.
4
Run `gcloud deployment-manager deployments update <deployment-name>`.
Provisions and updates the actual Google Cloud infrastructure resources based on the previewed state.
This final command transforms the previewed allocation plan into active infrastructure.

Key Concept

Cloud Deployment Manager Template Lifecycle and Preview Operations
Rate this question