VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso
Jump to solution

vRA 8 set cloud template property conditionally based on an input referencing a constant prop grp

I'm trying to use the property groups to dynamically set a couple of properties.  I've sort of got it working using the input property group type setting it to use an external action but this implementation is pretty awkward.  Related to some other previous posts on how these property groups end up being displayed it just seems really messy.  If I use some of the additional features in the custom forms I might be able to hide the property groups  once these are deployed from the service broker but I would prefer to get it all working regardless of just testing from cloud assembly or in the service broker.

What I'd like to do is have an input where I'm selecting from several options and based on those selections set some additional properties based on that selection referencing another property in a property group.  Its os related so for instance let's say I have a property

tier:
type: string
title: GV Tier
default: prd
minLength: 1
oneOf:
- title: default
const: default
- title: production
const: prd

in my property group named "MapThese" I have some values based on a couple of those inputs the os and tier like:

Key; centos_default, value: This is centos Default

Key; centos_prd, value: This is centos Production

Key; ubuntu_default, value: This is ubuntu Default

Key; ubuntu_prd, value: This is ubuntu Production

I want to set some other property like:

setMeTo: '${propgroup.MapThese.[index on the os + tier]}'

Is there a way to accomplish this?  I can pretty easily do this with extensibility workflows and/or actions but I'm trying to move as much of this logic up into the templates as I can.  The requestor does not need to see what these values are being set to but it might be cool to display the information on the form.  I'll keep messing with the input property groups as I might be able to get this method working to my satisfaction.  If only I could bind a normal template input to an action I think this would work but I don't see a way to do that unless you are using a property group defined input.

Reply
0 Kudos
1 Solution

Accepted Solutions
qc4vmware
Virtuoso
Virtuoso
Jump to solution

So turns out this worked easily once I got the syntax correct.  I created a property group of objects and just needed to reference it in the brackets.  I think in my initial attempts I was including a dollar sign or some other syntax error.  So this syntax worked

 

setMeTo: '${propgroup.MapThese.[input.os].somevalue}'

 

This sort of thing was in the manual and I just didn't absorb what I was reading.  RTFM for the win!

View solution in original post

Reply
0 Kudos
3 Replies
qc4vmware
Virtuoso
Virtuoso
Jump to solution

So turns out this worked easily once I got the syntax correct.  I created a property group of objects and just needed to reference it in the brackets.  I think in my initial attempts I was including a dollar sign or some other syntax error.  So this syntax worked

 

setMeTo: '${propgroup.MapThese.[input.os].somevalue}'

 

This sort of thing was in the manual and I just didn't absorb what I was reading.  RTFM for the win!

Reply
0 Kudos
xian_
Expert
Expert
Jump to solution

Can't find this in the docs: can you send the direct link pls?

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

I don't think I have a specific example from the docs just read back through the syntax guide and using the property groups and also the other more advanced examples.  If I stumble across a matching use case in the docs I'll update here with a link.

Reply
0 Kudos