I’m looking to be able to add a new key and value to a dictionary/object that is located in an array of dictionaries/objects, but I’m struggling at how to do so.
Scenario:
I’m looking to build a workflow that will deploy a VM and then make some adjustments inside the VM after deployment. Ideally, I would like to pass an array of dictionaries/objects to be able to deploy multiple VMs at once using “with items” in the tasks.
Below is an example of what I’m looking to pass to the workflow:
[
{
"Domain" : "example1.com",
"Param1" : "burger1",
"Param2" : "hotdog1",
"Param3" : "soda1"
},
{
"Domain" : "example2.com",
"Param1" : "burger2",
"Param2" : "hotdog2",
"Param3" : "soda2"
},
{
"Domain" : "example3.com",
"Param1" : "burger3",
"Param2" : "hotdog3",
"Param3" : "soda3"
}
]
The issue is that the IP address to access the VM isn’t known until the VM is deployed. What I would like to do is add the IP to the dictionary used to deploy the VM, such as going from:
{
"Domain" : "example1.com",
"Param1" : "burger1",
"Param2" : "hotdog1",
"Param3" : "soda1"
}
to:
{
"Domain" : "example1.com",
"Param1" : "burger1",
"Param2" : "hotdog1",
"Param3" : "soda1",
"IPAddress" : "127.0.0.1"
}
Has anyone added done this before and can point me in the direction I should head to achieve it?