Template Structure and YAML Syntax
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 content is provided strictly as legacy reference for maintaining, understanding, or migrating existing deployments.
What you'll learn: How legacy Deployment Manager templates are structured and written in YAML.
While configurations define what a deployment contains, templates serve as reusable blueprints that generate resource definitions programmatically. Templates allowed teams to create patterns once and use them many times with different inputs. When auditing or migrating older systems, understanding this structure is critical.
The Template File Structure
A legacy Deployment Manager template is a YAML file typically containing three key parts:
- Resources section (required): Defines the GCP resources created by the template.
- Properties (optional): Input values passed from the configuration that calls this template.
- Outputs (optional): Values exposed to other resources or configurations.
Think of templates like cookie cutters: the template is the cutter shape, and properties are the different doughs you press through it to get specific variations.
YAML Formatting Rules
Because Deployment Manager uses YAML, configurations are whitespace-sensitive. Indentation dictates the structure. The standard practice uses two spaces per level (tabs are not allowed). Key-value pairs use colons, and lists use hyphens:
resources:
- name: my-legacy-instance
type: compute.v1.instance
properties:
zone: us-central1-a
Required vs Optional Fields
When reading legacy templates, you will notice certain structural rules:
Required in every template:
- A
resourcessection with at least one resource block. - Each resource requires a
name, atype, and usuallypropertiesto define its specific settings based on the target API.
Optional fields:
- Template
propertiesdefinitions (to accept inputs from the main configuration). - An
outputssection (to share generated values, like dynamic IP addresses, with other components).
Templates separated the "how to build it" logic from the "what values to use" configuration, enabling infrastructure reuse in older Google Cloud environments.
Key Takeaway: Legacy Google Cloud Deployment Manager templates are YAML files with a required resources section that define reusable infrastructure patterns, relying on strict YAML indentation (2 spaces) and key-value syntax.