Passing Variables From the Setup Script to Configuration Management
A common use case for configuration management scripts is to inject environment data during the sandbox's setup phase. This is done using a custom setup script that prepares the data and passes it to predefined or dynamically-created variables on the App's configuration management.
For illustration purposes, the following setup script gets the sandbox owner's email from their CloudShell user profile and passes it to a dynamically-created parameter called "USER_MAIL" on target Apps that have an "Update Mail" attribute.
The main files in the script are:
__main__.py
: Entry point to the script. Note that the file includes anenable_configuration=False
flag, which disables the default out-of-the-box Configuration step to allow our custom code to run instead.configure_apps.py
: Custom orchestration function that replaces the out-of-the-box Configuration step in the sandbox's setup phase
To use the script:
- In Resource Manager Client > Resource Families explorer, do the following:
- Create an Update Mail attribute (Boolean, default: False).
- Set the attribute on the Generic App Family.
- Upload the script to CloudShell.
- Create a blueprint and replace the out-of-the-box Setup script.
- Add the suitable Apps to the blueprint.
- Set the attribute to True in the blueprint Apps.