GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples

Python configuration: resource name and name in property

Open
#449 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jinja
Stars
951
Forks
700
PR merge metrics
No merged PRs in 30d

Description

I have tried to dig into the documentation, but I can't find any good answer there.

What I want to know is, when is `name` in a resource's `properties` required?

From what I can gather from the examples, the name of the resource is automatically injected as the `name` property as well?

For example, a `compute.v1.address` has a `name` property, and it gets set to the resource name, if it's omitted.

```
def generate_config(context):

address = {
'name': context.env['name'],
'type': 'compute.v1.address',
'properties': {
'region': context.properties['region'],
'description': context.properties['description']
}
}

return {'resources': [address]}
```

Are there other properties that behave this way? A few lines about this behavior would be nice to have in the documentation.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.