Blueprints (Cloud Templates) in vRA use resource properties to define the characteristics of resources that will be used for deployment. Usually, these properties are standard to deployments targeting a particular use case. For instance, deploying Linux Servers in a development environment uses a standard/tested OS image/template. The compute/storage sizing of these Linux servers may also have been standardized.
Here is a cloud template specifying the resource-property values of the Virtual Machine, its Disks, and the network it would connect to. Later in this blog, you will see how the same Cloud template is streamlined using a property group.
Now, if you know that there could be many more similar cloud templates that may use the same standard Linux image, then you could group common reusable properties of the VM into a Property Group. Property Group is an assembler construct that can be referenced within cloud templates. It can be a grouping of any set of properties.
The illustration here shows property groups for Windows and Linux VMs referenced by multiple cloud templates. There is also a common_metadata property group that is referenced by all cloud templates.
Remember that a Property Group is an Assembler construct that stores properties as a list of key-value pairs. Hence, it can be a grouping of any key-value pair to store values for a resource-property in a cloud template.
I have created a property group, linux_dev_vm, to group some properties of the virtual machine.
Now, let's look at the updated code for the same cloud template using the Property Group that was created.
One of the benefits of using property groups is that any change to a property does not require modifying all the cloud templates. Instead, you modify the property group, and all cloud templates referencing the property group will dynamically secure the new property values. All new deployments will have a new/updated set of properties.
If you were to modify a property group, you would be warned accordingly.
It is essential to note the name of the property group cannot be modifed once created.
Referencing Properties from a JSON Object List
Related resource properties can also be stored as a single JSON object list.
A JSON object list is a set of key-value pairs enclosed in curly braces.
Example: {"key1":"value1","key2":"value2","key3":"value3"}
The following syntax can be used to reference items from a JSON list.
Syntax: ${from_json(input.<propertygroup>.<ObjectList Property>).<item_name>}
Example: ${from_json(input.linux_dev_vm.env).vcfolder}
Comments