Error when using "Merge Overrides" in Puppet Class Parameters and macros in Hiera

Add puppet class with a Hash parameter to a Host
Enable “Merge Overrides” on the parameter
Use template macros (i.e. <%= foreman_server_fqdn %>) in hiera value of that parameter
puppet agent will start failing with error:

Error 500 on SERVER: Server Error: Failed to find via exec: Execution of '/etc/puppetlabs/puppet/node.rb' returned 1: 

Can be tested with hash_resources class and setting the value of resources parameter to:

    ensure: present
    content: <%= foreman_server_fqdn %>

Expected outcome:
Hiera should work the way it works for “Merge Overrides” disabled

Foreman and Proxy versions:
Foreman 1.20.1
Puppet 3.6.2

Other relevant data:
The foreman production generates the following error

2018-12-22T09:35:18 [W|app|8688b] Failed to generate external nodes for
TypeError: no implicit conversion of String into Hash
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/core_ext/hash/deep_merge.rb:24:in `merge!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/core_ext/hash/deep_merge.rb:24:in `deep_merge!'
/usr/share/foreman/app/services/classification/values_hash_query.rb:160:in `block in update_hash_matcher'
/usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `reverse_each'
/usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `update_hash_matcher'
/usr/share/foreman/app/services/classification/values_hash_query.rb:52:in `merged_value'
/usr/share/foreman/app/services/classification/values_hash_query.rb:38:in `calculate_value'
/usr/share/foreman/app/services/classification/values_hash_query.rb:21:in `block in values_hash'


Foreman’s merge overrides feature only works with enumerals, ie. hashes and arrays. It seems you supply a string:

In the parameter settings, you did set the parameter to be of type hash (I guess from the type error above).

This might work as parameter:

{<%= foreman_server_fqdn %>}

AFAIK, Erb content is always stringyfied (this would also be logical).

I do understand that the merge overrides require hashes or arrays, it works absolutely fine with arrays/hashes until I use ERB to insert values in a hash (like the <%= foreman_server_fqdn %> example given in my question). Since the same hash works fine when merge overrides are disabled, and as seen in the logs, I believe I might be hitting some bug within the merge overrides functionality

This is this bug: Feature #9949: deep merge broken when using facts in hash - Foreman / - this is an issue for me too!