Template Schemas and Validation
Important Notice: Google Cloud Deployment Manager reached end of support on March 31, 2026. All new infrastructure work should be directed to Google Cloud Infrastructure Manager or Terraform. The following information is provided strictly as legacy reference for maintaining existing deployments. Do not use gcloud deployment-manager commands to initiate new deployments.
What you'll learn: How legacy template schemas were used to catch configuration errors early and document expected inputs.
What Is a Template Schema?
A schema is a blueprint that defines what inputs a template expects, their data types, and any constraints. Think of it like a restaurant menu that tells customers exactly what is available—if someone orders an invalid item, the system catches that mistake before sending the order to the kitchen.
In Deployment Manager, schemas are YAML or JSON files that sit alongside Python or Jinja2 templates (usually sharing the template name, appended with .schema). When evaluating a legacy configuration, the Deployment Manager engine validates the properties passed against the schema before attempting to update or provision resources.
Why Schemas Matter
Without a schema, typos and incorrect property values only fail when Google's API rejects them—potentially after minutes of processing. Schemas provided immediate feedback during the validation or update phases.
They also serve as essential documentation. Administrators maintaining older environments can look at the schema to understand required and optional properties without needing to read the underlying template code. When reviewing legacy scripts containing gcloud deployment-manager update commands, the schema details what inputs were considered valid for those resources.
Basic Schema Structure
A schema defines properties with data types and descriptions:
info:
title: Legacy VM Template Schema
description: Defines a GCE instance
properties:
zone:
type: string
description: GCP zone for the instance
machineType:
type: string
default: n1-standard-1
description: Machine type
required:
- zone
When reviewing or patching an existing deployment, Deployment Manager checks that the provided inputs still match this defined contract, preventing invalid configurations from breaking the current state.
Key Takeaway: In legacy Google Cloud Deployment Manager configurations, schemas validated template inputs prior to execution, catching errors early and acting as clear, automated documentation for maintaining infrastructure.