Can't use `each` statement on puppet 3.6

Solution In Progress - Updated -

Issue

Unable to use the each statement in puppet. Documentation for each statement: https://docs.puppet.com/puppet/3.6/reference/function.html#each

[root@undercloud ~]# cat test.pp
$sgrouptmp = [ 'test', 'test2', 'test3' ]

each($sgrouptmp) |$sgroup| {
  notify { $sgroup : }
}

This throws the following error

Error: Could not parse for environment production: Could not match |$sgroup| at /root/test.pp:3 on node undercloud.default.redhat.local
Error: Could not parse for environment production: Could not match |$sgroup| at /root/test.pp:3 on node undercloud.default.redhat.local

Environment

Red Hat Enterprise Linux 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content