If you’re using a security group input in a form that is attached to a catalog and you need to reference that security group input in the catalog configuration, the following configuration might not work as expected:
“securityGroups”: [
{
“id”: “<%= customOptions.sg%>”
}
]
As a workaround, you can use the following Groovy snippet to properly parse and utilize the security group input:
“securityGroups”: [
{
“id”: “<%= new groovy.json.JsonSlurper().parseText(customOptions.sg?.toString())?.getAt(0)?.id%>”
}
]
Thanks
Velan
1 Like
Removing the quotes should do the job too
We are provisioning RDS instances via terraform through morpheus
Configuration
Spec template → Catalog (uses forms)
Form uses security group option list and allows multiple selection of security groups
Form is attached to the catalog.
Catalog item contains
vpc_security_group_ids": “<%=customOptions.vpc_security_group_ids%>”,
When provisioining, the form displays drop down for selecting multiple security groups.
Once a security group(s) is selected and you select “Add to Order” we get t…
1 Like
"securityGroups": <%= customOptions.sg%>
This will also work as a solution. It will automatically insert the array of security group IDs selected during the catalog item order.
Please note this is assuming you have set the field name of the form option to be “sg”.
1 Like