"Invalid Resource Type" trying to use Puppet's Defined Resource Type
<p>Puppet beginner here so maybe I'm doing something wrong...</p>

<p>I have a manifest that contains the following define</p>

<pre><code>define amqconf (
    $activemq_home = '/opt/apache-activemq',
    $group         = 'activemq',
    $mode          = 0644,
    $owner         = 'activemq',
    $broker_name   = $title,
    $broker_port   = 61616,
) { 
    file { $title:
        ensure  =&gt; present,
        path    =&gt; "${activemq_home}/${broker_name}/conf/activemq.xml",
        content =&gt; template('profiles/activemq.xml.erb'),
    }
}
</code></pre>

<p>and then tries to use that define</p>

<pre><code>$broker_conf = hiera('profiles::activemq::broker::conf')
create_resources( amqconf, $broker_conf )
</code></pre>

<p>but when I try and use this class I get the following error</p>

<pre><code>Info: Using configured environment 'testing'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type amqconf at /etc/puppetlabs/code/environments/testing/modules/profiles/manifests/activemq.pp:73:5 on node cust-stage.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
</code></pre>

<p>What do I need to do in order to be able to use this define?</p>

<p>EDIT: added complete manifest</p>

<pre><code>class profiles::activemq {

    include archive
    include profiles::java_7_oracle

    $activemq_version = '5.13.3'

    define amqconf (
        $activemq_home = '/opt/apache-activemq',
        $group         = 'activemq',
        $mode          = 0644,
        $owner         = 'activemq',
        $broker_name   = $title,
        $broker_port   = 61616,
    ) {
        file { $title:
            ensure  =&gt; present,
            path    =&gt; "${activemq_home}/${broker_name}/conf/activemq.xml",
            content =&gt; template('profiles/activemq.xml.erb'),
        }
    }

    group { 'activemq':
         ensure =&gt; present,
    }
    user { 'activemq':
        groups =&gt; 'activemq',
        comment =&gt; 'Service user for running the ActiveMQ service',
        home =&gt; "/opt/apache-activemq-$activemq_version",
        ensure =&gt; present,
        shell =&gt; '/bin/bash',
    }

    file { "/opt/apache-activemq-$activemq_version" :
        ensure =&gt; directory,
        owner  =&gt; 'activemq',
        group  =&gt; 'activemq',
        mode   =&gt; '0755',
    }
    archive { "/tmp/apache-activemq-$activemq_version-bin.tar.gz" :
        ensure        =&gt; present,
        source        =&gt; 'http://archive.apache.org/dist/activemq/5.13.3/apache-activemq-5.13.3-bin.tar.gz',
        checksum      =&gt; 'c19e2717f5c844a2f271fcd39eb024d04ebcfa5d',
        checksum_type =&gt; 'sha1',
        extract       =&gt; true,
        extract_path  =&gt; '/opt',
        creates       =&gt; "/opt/apache-activemq-$activemq_version/bin",
        cleanup       =&gt; true,
        user          =&gt; 'activemq',
        group         =&gt; 'activemq',
    }

    # Create the brokers defined in hiera.
    $brokers = hiera('profiles::activemq::brokers')
    $broker_defaults = {
        cwd   =&gt; "/opt/apache-activemq-${activemq_version}",
        group =&gt; 'activemq',
        user  =&gt; 'activemq',
    }
    create_resources( exec , $brokers, $broker_defaults )

    $broker_conf = hiera('profiles::activemq::broker::conf')
    create_resources( amqconf, $broker_conf )

}
</code></pre>