Google Cloud Deployment Manager provides deployment-specific environment variables like Project ID and Deployment name.
def GenerateConfig(context):
resources = []
resources.append ({
'name': 'vm-' + context.env["deployment"],
'type': 'compute.v1.instance',
'properties': {
'serviceAccounts': [{
'email': context.env['project_number'] + '-compute@developer.gserviceaccount.com',
'scopes': [...]
}]
}
...}]
return {'resources': resources}
Reference: https://cloud.google.com/deployment-manager/docs/configuration/templates/use-environment-variables
I don't find any example to set any custom environment variable that can be used by my templates. If there is no support for this functionality, any hack on how to achieve this functionality will be very helpful
Google Cloud Deployment Manager, similar to terraform is an IaC service which will help us in provisioning, deleting and modifying the Infrastructure components. So, in general these variables will be fixed as they need to be understood by the cloud provider and in some cases like machine type the input is also selective that means you can’t enter your desired value you have to select from the list of options available. Can you provide more details on why you require this feature and what are you trying to achieve here? It will help us in better understanding your problem or use case.
updates: