'Puppet: Could not find resource 'File[/etc/auditbeat/auditbeat.yml]' in parameter 'require'

I'm using Puppet to replace Spacewalk Configuration Channels. I'm very new to puppet, and the class I'm writing should copy some files to the host system. I have this in my class:

class main_configurations {
  file { '/etc/auditbeat':
    ensure  => directory,
    path    => '/etc/auditbeat',
    require => File['/etc/auditbeat/auditbeat.yml'],
    source  => 'puppet:///modules/main_configurations/auditbeat/auditbeat.yml',
    recurse => true,
  }
}

But when I run puppet agent -t I get the following error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'File[/etc/auditbeat/auditbeat.yml]' in parameter 'require' (file: /etc/puppetlabs/code/environments/production/modules/main_configurations/manifests/init.pp, line: 8) on node <servername>

For completeness, this is the folder structure on my puppet server:

/etc/puppetlabs/code/environments/production/modules/main_configurations/files/auditbeat
/etc/puppetlabs/code/environments/production/modules/main_configurations/files/auditbeat/auditbeat.yml
/etc/puppetlabs/code/environments/production/modules/main_configurations/files/auditbeat/audit.rules.d
/etc/puppetlabs/code/environments/production/modules/main_configurations/files/auditbeat/audit.rules.d/auditbeat-rules.conf


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source