Need help regarding attribute arrays

Hello,

We have the following attribute array in Chef Automate and we're wondering how to use it correctly in code?

image

Here's what we have so far.

newrelic attributes:

node.default['newrelic-infra']['infra_tag'] = if node.recipes[1].include? 'domain_base'
                                                'ips-domain-joined'
                                              else
                                                'non-domain-joined'
                                              end

newrelic recipe:

  template 'C:\Program Files\New Relic\newrelic-infra\newrelic-infra.yml' do
    source 'newrelic-infra.yml.erb'
    variables(
      'license_key' => node.default['newrelic-infra']['license_key'],
      'display_name' => node.default['newrelic-infra']['display_name'],
      'log_file' => node.default['newrelic-infra']['log_file'],
      'verbose' => node.default['newrelic-infra']['verbose'],
      'proxy' => node.default['newrelic-infra']['proxy'],
      'infra_tag' => node.default['newrelic-infra']['infra_tag']
    )

newrelic-infra.yml.erb:

license_key: <%= @license_key %>
custom_attributes:
  infra_tag: <%= @infra_tag %>

Basically, if the value of recipes[1] has 'domain_base' in it, it should set the infra_tag to 'ips-domain-joined'. Any idea what's the correct syntax to use? Gladly appreciate the help.

That seems like a overly complicated way unless I'm missing something. I typically use a role that is blank instead to specify specific attributes, recipes, etc to be applied in special cases. Then you add the role to the runlist of your node.