Chef create directories recursively with owner
<p>I need to create a tree of directories with owner "testuser".
But if I'm specify "/foo/bar/baz" only "baz" created under "testuser", "/foo" and "/foo/bar" own to "root" user.</p>

<pre><code>directory /foo/bar/baz do
  owner 'testuser'
  group 'testuser'
  recursive true
  action :create
  mode '0755'
end
</code></pre>

<p>Based on this documentation <a href="https://docs.chef.io/resource_directory.html" rel="nofollow">https://docs.chef.io/resource_directory.html</a>
we can use following structure and it's ok until I'm trying to use variables as directories.</p>

<pre><code>%w[ /foo /foo/bar /foo/bar/baz ].each do |path|
  directory path do
    owner 'testuser'
    group 'testuser'
    mode '0755'
  end
end
</code></pre>

<p>If I specify variables in this list I've got directories with names "#{node[‘foo’]}" and so on.</p>

<pre><code>%w[ #{node[‘foo’]} #{node[‘bar’]} #{node[‘baz’]} ].each do |path|
  directory path do
    owner 'testuser'
    group 'testuser'
    mode '0755'
  end
end
</code></pre>

<p>How to create a list of directories variables which will be expanded?</p>