If I'm using a Jinja template I can override properties via command line like this:
--properties zone:us-central1-a,machineType:n1-standard-1,image:debian-9
But I see no documentation or examples for doing this with nested properties like labels or environmentVariables for example:
resources:
- name: resource-name
type: 'gcp-types/cloudfunctions-v1:projects.locations.functions'
properties:
labels:
testlabel1: testlabel1value
testlabel2: testlabel2value
environmentVariables:
TEST: 'zzzzzzzzz'
How do set properties like these? This does not work: --properties labels:testlabel1:newvalue
.
The short answer here is that the --properties
flag is not meant to pass property values to the template. A template cannot run without a configuration file, the --properties flag is meant to replace the config file. Each parameter you pass is the same as listing them in a config file.
Essentially using --template my-template.py --properties zone:us-central1-f
is the equivalent of running --config myConfig.yaml
where the YAML is defined as such:
imports: - path: my-template.py resources: - name: some-resource type: my-temaplte.py properties: zone: us-central1-f
The --properties
flag is not meant to pass raw data to replace non-variables.
Although this does not directly answer your question, you shouldn't normally need to define nested values in the flag. Your template will generally call on direct variables taken from the object properties
.
despite this, I did try some tests, and as far as I can tell, you can't do this.