Q:

Chef throws an ArgumentError asking for a name relating to a template resource

I am trying to use this github cookbook to install kibana. When I try to run it using the following command, I get this error which does not make much sense to me at this point. What name is the error referring to? According to their docs, all I had to do was run kibana::default and that should have done it.
chef-client -o 'recipe[kibana::default]'
Starting Chef Client, version 12.15.19
resolving cookbooks for run list: ["kibana::default"]
Synchronizing Cookbooks:
  - kibana (0.2.1)
  - build-essential (2.3.1)
  - ark (2.2.1)
  - apt (2.8.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/kibana/recipes/default.rb
================================================================================

ArgumentError
-------------
You must supply a name when declaring a template resource

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/kibana/recipes/_service.rb:3:in `from_file'
  /var/chef/cache/cookbooks/kibana/recipes/kibana5.rb:35:in `from_file'
  /var/chef/cache/cookbooks/kibana/recipes/default.rb:27:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/kibana/recipes/_service.rb:

  1:  # Encoding: utf-8
  2:
  3>> template node['kibana']['service']['template_file'] do
  4:    cookbook node['kibana']['service']['cookbook']
  5:    source node['kibana']['service']['source']
  6:    mode '0o0755'
  7:    variables(
  8:      version: node['kibana']['version'],
  9:      bin_path: node['kibana']['service']['bin_path'],
 10:      options: node['kibana']['service']['options'],
 11:      recent_upstart: (node['platform_family'] != 'rhel')
 12:    )

Platform:
---------
x86_64-linux

Running handlers:
Running handlers complete
Chef Client failed. 0 resources updated in 03 seconds

A:

In chef when you define a resource, you have to give it a name it can be referenced by
In this example:
template 'my_template' do
  source 'my_template.erb'
  path '/etc/my_template'
end

i'm creating a template and giving it the name 'my_template'. Very often the name will be used as what would be considered the primary component of the resource, in this case it is the path, so it is quite common to see the target file used as the name for a template such as
template '/etc/myapp.conf' do
  source 'myapp.conf.erb'
end

In this case both the name and the path are '/etc/myapp.conf'
Looking at the attributes file in the cookbook you are referencing there is no default value for the node['kibana']['service']['template_file'] attribute, and a case statement to populate it, and other information based on the platform and version detected at run time.
So if you are running on a platform that it does not support, the value ends up being empty (nil in ruby) which is not an acceptable value for a name on a resource
Relevant section of the attribute file in github at the time this was written:
# kibana service configurations - defaults to settings for Ubuntu 14.04
case node['platform']
when 'centos', 'amazon'
  if node['platform_version'] < '6.9'
    default['kibana']['service']['provider'] = Chef::Provider::Service::Init::Redhat
    default['kibana']['service']['source'] = 'initd.kibana.erb'
    default['kibana']['service']['template_file'] = '/etc/init.d/kibana'
  else
    default['kibana']['service']['provider'] = Chef::Provider::Service::Systemd
    default['kibana']['service']['source'] = 'systemd.service.erb'
    default['kibana']['service']['template_file'] = '/usr/lib/systemd/system/kibana.service'
  end
when 'ubuntu'
  if node['platform_version'] < '16.04'
    default['kibana']['service']['provider'] = Chef::Provider::Service::Upstart
    default['kibana']['service']['source'] = 'upstart.conf.erb'
    default['kibana']['service']['template_file'] = '/etc/init/kibana.conf'
    default['kibana']['service']['upstart'] = true
  else
    default['kibana']['service']['provider'] = Chef::Provider::Service::Systemd
    default['kibana']['service']['source'] = 'systemd.service.erb'
    default['kibana']['service']['template_file'] = '/lib/systemd/system/kibana.service'
  end
end

It is not established before that case block, and the case block has no else statement, so outside of those two situations (centos, aws, or ubuntu) it's not going to work

