Smart Class Parameter override not applying to module included in profile class

I have a need to pass a Foreman Host Group parameter to a Puppet module where it will be used in a template like so:

  • Create the component module
class my_module (
  file { 'my_file':
    ensure  => 'file,'
    content => epp(my_module/my_template.epp, { foreman_param => $foreman_param }),
  • Create the template

my_value = <%= $foreman_param %>

  • Import the class into Foreman and override it’s value with an ERB template containing the Host Group Parameter

Everything up to here works as expected. If my_class is assigned to a node the Foreman ENC inserts a dynamic value for $foreman_param based on the nodes host group.

The issue arises when I add my_module to a profile class. All of my attempts so far have resulted in “Class my_profile expects a value for parameter $foreman_param” type errors during puppet runs on a test node.

  • This doesn’t work:
class my_profile {
 include my_module
  • Nor does this with the Foreman Smart Class Parameter override replicated for my_profile::foreman_param:
class my_profile ( $foreman_param, ){
  include my_module

Any ideas on what my problem is here?