Question

Difficulty: MediumImplementing Infrastructure as Code using Terraform and Deployment Manager

A healthcare analytics team is standardizing its Google Cloud deployment practices using Google Cloud Deployment Manager and HashiCorp Terraform. The cloud architect needs to enforce schema validation for Deployment Manager resource templates and prevent concurrency issues or race conditions when team members apply Terraform configurations simultaneously. Which TWO actions should the team implement to satisfy these operational requirements?

  1. Include a explicit schema file alongside Deployment Manager Jinja2 or Python templates to enforce parameter types and required resource properties.Answer
  2. Configure a Google Cloud Storage (GCS) remote backend in Terraform configurations to store state centrally with state locking enabled.Answer
  3. C
    Store Terraform state files on a shared Network File System (NFS) mount across team developer workstations to enable file-level locking.
  4. D
    Assign the IAM Owner primitive role to the service account executing deployment templates to avoid API permission errors during provisioning.

Answer

The team should include a explicit `.schema` file alongside Deployment Manager templates to enforce parameter types and required properties, and configure a Google Cloud Storage remote backend in Terraform configurations to manage state centrally with automatic object locking.
To enforce input parameter validation and structure for Deployment Manager templates, creating explicit schema files (in JSON Schema format) alongside Jinja2 or Python templates validates configurations prior to provisioning. To safeguard Terraform infrastructure state across multi-developer or automated execution pipelines, configuring a Cloud Storage remote backend ensures centralized state management with automatic object locking, preventing concurrent state file updates.

Step-by-Step Solution

1
Analyze Deployment Manager template validation requirements
Identify that Cloud Deployment Manager supports `.schema` files (written in JSON Schema format) accompanying Jinja2 or Python templates to validate parameters and enforce required properties before deployment execution.
Schema files prevent invalid or malformed configurations from failing mid-deployment.
2
Evaluate Terraform remote state management best practices
Identify that configuring the `gcs` backend stores state in a Google Cloud Storage bucket with native state locking support.
Remote GCS backends prevent multiple concurrent runs from corrupting state through locking mechanisms.
3
Identify architectural antipatterns in remaining options
Reject storing state files on shared local/NFS disks and assigning primitive IAM Owner roles to execution service accounts.
Shared local storage causes state corruption, and primitive IAM roles violate least-privilege security controls.

Key Concept

Deployment Manager Schema Validation and Terraform GCS Remote State Locking
Rate this question