What is the recommended approach for using an attribute in a resource, like a template, when there is no reasonable default for that attribute. The attribute value is expected to be provided at runtime. If it is not, the chef recipe execution should error.
The way I have things now the attribute value when applied to the template is empty string.
/recipes/default.rb
template "/var/tmp/my_script.sh" do
source "my_script.erb"
mode "0755"
variables({
:url => node['environment']['url']
})
end
/templates/default/my_script.erb
#!/bin/bash
echo "The url is: <%= @url %>"
The resulting /var/tmp/my_script.sh file would looks like this:
#!/bin/bash
echo "The url is: "
But I wish it would just error out. Any advice?