GoogleCloudPlatform / deploymentmanager-samples

Deployment Manager samples and templates.
Apache License 2.0
948 stars 716 forks source link

Google deployment manager hierarchical configuration with "Organization_with_departments" #485

Open gbhojak opened 5 years ago

gbhojak commented 5 years ago

Hello,

I have cloned the repo at https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/community/hierarchical_configuration/Organization_with_departments

I uncommented the code in env_demo_project.py to return resources and outputs. I have followed the instructions mentioned and while running gcloud deployment-manager deployments create hierarchy-org-example-dev --template env_demo_project.py --properties=envName:dev, I get the following error:

ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1564632303149-58f0658a2218c-8ce00982-a115f932]: errors:
- code: MANIFEST_EXPANSION_USER_ERROR
  location: /deployments/hierarchy-org-example-dev/manifests/manifest-1564632303171
  message: |-
    Manifest expansion encountered the following errors: Exception in env_demo_project.py
    Traceback (most recent call last):
        return constructor[m](evaluation_context)
      File "<string>", line 28, in GenerateConfig
    KeyError: 'HQ_Address'
     Resource: env_demo_project.py Resource: config

I have set the symbolic links for org_config.py and department_config.py as well, but I keep running into this issue. I am not sure if this is a bug or is I am missing something, I have followed instructions properly.

Regards, Giriraj

ocsig commented 5 years ago

Hi,

Thank you for reporting, I just ran into the same issue last week, did not have a time to fix it. I will review the repo.

The solution is:

'value': cc.configs['HQ_Address'] >> 'value': cc.configs['Org_level_configs']['HQ_Address']

I added some namespacing to some of the config files. (This is coming from global/configs/org_config.py

gbhojak commented 5 years ago

Thank you for responding quickly. The changes to namespace references for 'Org_level_configs' in couple of files helped me move forward.