Foreman (or any ENC for that matter) cannot create define resources directly, only class resources. The usual way to handle this is a “wrapper class” which takes the take you wish to define as class parameters, and calls the appropriate defines.
Ah I see, then passing in $vhosts seems to be all you need. Edit the class via Classes > Apache::Vhosts > $vhosts and you’ll be able to set the data type there - you need to use a hash, but you can use Ruby, YAML, or JSON style, as you prefer.
Your example isn’t valid YAML, so I’m unsurprised it’s rejected. What you have there looks like JSON to me… however, it’s still not valid. You need a structure of “key” => “hash of values”, same as you would declare in Puppet itself. Given the code in the first post, something like: