Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/kalofero/public_html/blog/wp-includes/class-wp-hook.php on line 286
Extending Custom Naming with Custom Properties in Cloud Assembly (SKKB1046) | Spas Kaloferov's Blog

Extending Custom Naming with Custom Properties in Cloud Assembly (SKKB1046)

In this article, we will look how to extend the custom naming dunctionality in VMware Cloud Assembly with custom properties .


Update Log:


I’m back baby.

After few months pause, stuck at home due to you know what, I’ve decided to write few posts that have been in my to do list. So lets start !!!

As a VMware Cloud Assembly cloud or project administrator, you have a prescribed naming convention for resources in your environment, and you want the deployed resource to follow those conventions without user interaction. You can create a naming template for all deployments from a Cloud Assembly project.
There is a good example on how to set up custom naming provided in the link below, but I’m going to extend that example and show how to use custom properties to further customize the custom naming template.

How do I customize the names of deployed resources using Cloud Assembly?


A dedicated post on custom properties will follow .

Issue and Solution

The specified template will substitute the auto-generated machine names. Make sure the template generates unique names for this project, otherwise the deployment may fail if a machine with the same name already exists.
Here are the available properties to use:

  • Resource properties: includes the resource name from blueprint template, custom properties assigned to the resource (from blueprint, project, etc.). e.g. ${resource.image}, ${resource.name}
  • Endpoint properties: use any endpoint or custom property assigned to the endpoint e.g. ${endpoint.endpointType}
  • Project properties: name and description e.g. ${project.name}
  • User name, user: ${userName}, ${user}
  • Number generator: add digits to generated names to make them unique. ${######} adds 6 digits.

Lets say though that these properties are not enough. I may want to provide a blueprint input value in the template. For example I want users to be able to specify during provisioning a server code that means something for by business and that server code to become part of the naming in the naming template. E.g. DES – for desktop machines, WEB for web servers, DB – for DB servers, ect…
As you can see this option is not there by default. So we will utilize custom properties to get the blueprint input and pass it to the custom naming template.

So let’s start first in the Blueprint.
I’m going to add inputs that specify the code for each machine resource. In my case I have a 2-tier Web app. So I want to specify the DB and WEB codes as inputs. Therefore, I will add 2 inputs:

  1. ...
  2.   webCode:
  3.     type: string
  4.     title: Web Code
  5. ...
  6.   dbCode:
  7.     type: string
  8.     title: DB Code
  9. ...

As you can see I’ve defined a custom property with name nameCode (same name for all machine resources) and I’ve passed it the input value for the code name.

  1.   web-tier:
  2.     type: Cloud.Machine
  3.     dependsOn:
  4.      - db-tier
  5.     properties:
  6.       nameCode: '${input.webCode}'
  7.   db-tier:
  8.     type: Cloud.Machine
  9.     properties:
  10.       nameCode: '${input.dbCode}'

Now lets go to our project and set a custom naming template.
I going to use other properties for my VM name like project name , number generator , ect.. which are available out of the box. Important part to note her is how to refer to the custom property in the custom naming template. Because I’ve created the custom property within the properties “bag” section in the Blueprint I can access it by using ${resource.nameCode} .My naming template looks like this:


During Blueprint provisioning I will specify the code names I want to use for both servers as inputs. In my case these are DB and WEB .

As you can see once the deployment finished the name of the machine resources contain the input codes I’ve specified.



Final Step

If all went well, go grab a beer.

DISCLAIMER; This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual.
All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
Unless stated, all photos are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. If used with watermark, no need to credit to the blog owner. For any edit to photos, including cropping, please contact me first.
Unless stated, all recipes are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. Please credit all recipes to the blog owner and link back to the original blog post.
Downloadable Files
Any downloadable file, including but not limited to pdfs, docs, jpegs, pngs, is provided at the user’s own risk. The owner will not be liable for any losses, injuries, or damages resulting from a corrupted or damaged file.
Comments are welcome. However, the blog owner reserves the right to edit or delete any comments submitted to this blog without notice due to
– Comments deemed to be spam or questionable spam
– Comments including profanity
– Comments containing language or concepts that could be deemed offensive
– Comments containing hate speech, credible threats, or direct attacks on an individual or group
The blog owner is not responsible for the content in comments.
This policy is subject to change at anytime.

Leave a Reply

Your email address will not be published. Required fields are marked *