skarkhanis
Contributor
Contributor

Adding Capability Tags & Constrain Tags on Event Subscription Dynamically

Hi, we are in process of shifting to vRA 8.5 from vRA 7.6. We are trying to add dynamic tags to cloud template based on user input and some workflow in backend which decides the placement of machine and network to use.

Currently we are able to place and provide network of our choice by directly using tags in Cloud Template however we want that to happen dynamically on Events such as Compute Reservation & Compute Allocation. Is there any way to this please? I have pasted the code below which we need to change on above Event Subscriptions

 

Cloud_vSphere_Machine_1:
  type: Cloud.vSphere.Machine
  properties:
    networkType: existing
    constraints:
     - tag: site:0005

Cloud_vSphere_Network_1:
  type: Cloud.vSphere.Network
  properties:
    networkType: existing
    constraints:
     - tag: infoblox-demo
     - tag: SG:5021

 

 

0 Kudos
1 Reply
Ankush11s
VMware Employee
VMware Employee

As 7.x and 8.x , Both are 2 different products so similar solution may not be the key.
You can use If else condition in yaml which would decide which cloud zone it is going to pick and based the that storage and network will get allocated . 

Example of If else .

formatVersion: 1
inputs:
  Cluster:
    type: string
    description: Choose Cluster
resources:
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      image: Linux
      flavor: Small
      constraints:
        - tag: '${input.Cluster == "vRA_Payload1" ? "vCenter115:vRA_Payload1" : input.Cluster == "vRA_Payload2" ? "vCenter115:vRA_Payload2" : input.Cluster == "vRA_Payload3" ? "vCenter115:vRA_Payload3" : ""}'
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing