Question

Difficulty: HardDeploying Infrastructure using Deployment Manager or Terraform

A Cloud Engineer needs to modify an existing Google Cloud Deployment Manager deployment named `prod-network-deployment` to update firewall rules defined in `network_config.yaml`. To adhere to strict operational compliance, the engineer must stage and preview the proposed infrastructure changes, inspect the staged manifest to verify resource state, and then commit the updates to production. In what sequence should the engineer execute these tasks?

  1. 1Update the local `network_config.yaml` file with the new firewall rule specifications.
  2. 2Execute `gcloud deployment-manager deployments update prod-network-deployment --config network_config.yaml --preview`.
  3. 3Execute `gcloud deployment-manager deployments describe prod-network-deployment`.
  4. 4Execute `gcloud deployment-manager deployments update prod-network-deployment` without the `--config` flag.

Answer

The correct sequence starts with updating the local `network_config.yaml` file, followed by staging the preview with `gcloud deployment-manager deployments update prod-network-deployment --config network_config.yaml --preview`, reviewing the staged manifest using `gcloud deployment-manager deployments describe prod-network-deployment`, and finally committing the previewed deployment using `gcloud deployment-manager deployments update prod-network-deployment`.
To preview and safely commit updates in Google Cloud Deployment Manager, configuration files must first be updated locally. Next, running `gcloud deployment-manager deployments update` with the `--preview` flag creates a staged manifest without applying changes to active infrastructure. Running `gcloud deployment-manager deployments describe` outputs the staged changes for audit and verification. Finally, executing `gcloud deployment-manager deployments update` without passing a config file applies the previously staged preview.

Step-by-Step Solution

1
Modify the local deployment configuration file (`network_config.yaml`).
The target state definition is updated locally.
Deployment Manager requires updated source files to evaluate schema changes.
2
Execute the preview command using `gcloud deployment-manager deployments update prod-network-deployment --config network_config.yaml --preview`.
The proposed deployment update is calculated and staged in preview mode.
The `--preview` flag allows reviewing changes safely without modifying active cloud resources.
3
Inspect the deployment state using `gcloud deployment-manager deployments describe prod-network-deployment`.
The detailed manifest of staged pending changes is displayed.
Verifying the manifest ensures no unintended resource modifications occur.
4
Commit the staged deployment changes using `gcloud deployment-manager deployments update prod-network-deployment`.
Deployment Manager applies the pending preview manifest to live GCP infrastructure.
Omitting `--config` applies the currently staged preview without re-parsing or overriding the input file.

Key Concept

Deployment Manager Preview and Update Lifecycle Execution
Rate this question