title: chef rewind cookbook_file definition from a wrapper cookbook recipe
body: <p>I am using an cookbook github.com opscode-cookbooks/openldap.
  I wrote an wrapper cookbook "lab_openldap" that includes "openldap::server" recipe.</p>
  
  <p>The server.rb recipe uses following clausule to upload the PEM file from cookbooks files/ssl/*.pem to server to the location node['openldap']['ssl_cert'].</p>
  
  <pre><code>if node['openldap']['tls_enabled'] &amp;&amp; node['openldap']['manage_ssl']
    cookbook_file node['openldap']['ssl_cert'] do
      source "ssl/#{node['openldap']['server']}.pem"
      mode 00644
      owner "root"
      group "root"
    end
  end
  </code></pre>
  
  <p>The PEM is tried to be read from "openldap" cookbook file/ssl/#{node['openldap']['server']}.pem" location. </p>
  
  <p>I have my PEM file in wrapper "lab_openldap" cookbook file/ssl/#{node['openldap']['server']}.pem" location. </p>
  
  <p>Is it possible to modify the "lab_openldap::server.rb" recipe to load PEM from a wrapper cookbook?</p>
  
  <p>Notes:
  I am aware of <a href="https://github.com/bryanwb/chef-rewind" rel="nofollow">https://github.com/bryanwb/chef-rewind</a> but it does not seem to manage this situation.</p>
  
  <h2>Update</h2>
  
  <p>The provided answer using <code>r.resource</code> is correct. </p>
  
  <p>Actually the issue in the particular code is on "source" keyword that according to <a href="http://docs.opscode.com/resource_cookbook_file.html" rel="nofollow">http://docs.opscode.com/resource_cookbook_file.html</a> refers to the location of a file in the /files directory in a cookbook located in the chef-repo.</p>
  
  <pre><code>r = resources("cookbook_file[#{node['openldap']['ssl_cert']}]")
  r.cookbook('lab_openldap')
  
  cookbook_file node['openldap']['ssl_cert'] do
      source "ssl/#{node['openldap']['server']}.pem"
      mode 00644
      owner "root"
      group "root"
  end
  </code></pre>