This post is the third part of the Google Deployment Manager (GDM) series. For a simplified overview and evolution of operations followed by an introduction to GDM, check out the first part of the series here followed the second part here which talks about using configurations in GDM.
GDM supports only a handful of python libraries for use with it. You will find the complete list of supported libraries here.
A schema allows defining setting validation for a supplied template. GDM uses the schema to validate the template before it is expanded and deployed. An example would best depict it.
Let’s say we are defining templating for VPC. You need to place the below schema alongside the template.
info:
title: Network
description: >
Creates a single network and its subnetwork
required:
- subnetworks
properties:
subnetworks:
type: array
description: >
An array of subnetworks.
item:
description: >
A subnetwork, defined by its region and its CIDR.
type: object
properties:
region:
type: string
cidr:
type: string
This schema defines subnetworks
as a required field of type array.
If you find yourself deploying the same set of resources repeatedly, it is possible to use the defined templates for these together as a composite type. An example would be, deploying an internal load balancer, which consists of 4 resources. These resources can be deployed as a composite resource for better user experience and management.
Templates for most of the resources in GCP are already developed, ready for use. You can find these here inside the cloud-foundation-toolkit GitHub. repository.