Hi Raghu,
It sounds like you want to use the map function:
https://puppet.com/docs/puppet/6.17/function.html#map
Here's an example of how to use it with your data structure:
$array_inputs = $vm_data.map |$region| {
$hash_region = {
location=> $region['location'],
vm_list => $re
Thanks for the reply.
I didn't understand what you are trying to say.
The code is something like this:
$array_inputs = []
$vm_data.each |$region| {
$hash_region = {
location => $region['location'],
vm_list => $region['vmlist'],
customer_id => "customer-${$region['location']}",
api_key => "api-
Hi Raghu,
Yes this is possible. Your example looks workable, but don't forget to add
commas after the values of the hash.
Check out Puppet's 'reduce' function, it iterates over data and allows you
to return a new structure after all the iteration which could be your new
hash. Alternatively it mig
Hi Guys
Some one help me solving this issue.
*Example:*
[
{
name => raghuram,
age => 22
},
{
name => vinay
age => 25
}
]
the idea is to iterate through an existing hash and create new hash with
some modifications and add it to array.
Thanks in adv