Can Google Cloud Deployment Manager have a python file as main configuration

Viewed 182

I've worked with deployment manager at small scale before. However, things are getting bigger and I want to switch from Jinja templates to Python.

I was wondering if it is also possible to define the main config.yaml also as python and not only the templates.

Hoped to see something in the official samples.

I read the guide for deployment manager at scale where it looks like this is only for using python files and not YAML's.

But unfortunately the links to GitHub are ending up in 404's.

The following makes me think the main file could be a python file:

gcloud deployment-manager deployments create hierarchy-org-example-dev
--template env_demo_project.py --properties=envName:dev
gcloud deployment-manager deployments create hierarchy-org-example-test
--template env_demo_project.py --properties=envName:test
gcloud deployment-manager deployments create hierarchy-org-example-prod
--template env_demo_project.py --properties=envName:prod

Does anyone know, where to find these configuration_hierarchy samples did go.. or can anyone provide me with another example?

1 Answers

You can't have you main file in Python - it has to be YAML:

A configuration file defines all the Google Cloud Platform resources that make up a deployment. You must have a configuration file to create a deployment. A configuration file must be written in YAML syntax.

However - as you notices - your template files can be in Python:

Templates can be written in either Jinja 2.10.x or Python 3.x. Jinja maps more closely to the YAML syntax, so it might be easier to write templates in Jinja if you are more familiar with YAML.

Related