Although I like generic approaches, I think in this case (where there's only 3 attributes possible), we should code them like this
(I also added the action attribute)

```ruby
node['cacert']['certs'].each do |name, opts|
  Chef::Log.debug "Create cacerts #{id} from attribute"
  cacert id do
    source   opts['source']        if opts['source']
    cert_dir opts['cert_dir']      if opts['cert_dir']
    hash     opts['hash']          if opts['hash']
    action   cert['action'].to_sym if cert['action']
  end 
end
```