# Revision history [back]

A couple of issues here.

First,

create_resources('ssh_authorized_key',hiera('ssh_keys'),{ user => $title })  will result in each ssh_authorized_key having the user set to the name of the class (possibly node def) of what calls it. If you want to use this sort of syntax, you will need to use a wrapper defined type, such as: define module::my_ssh_auth_keys($name,
$key,$ensure  = present,
$type = 'ssh-dss',$user    = $name,$options = []
){
ssh_authorized_key{
$name: ensure =>$ensure,
name    => $name, type =>$type,
user    => $user, options =>$options,
}


Then in your node def, or a role or profile class, you can do like:

create_resources('module::my_ssh_auth_key',hiera('ssh_keys'))


I generally recommend the use of $name over $title because you get a more consistent behavior between classes and defines. There are some edge cases where \$title will not do what would be expected.