Hello,
I've a problem with hiera and functions.
I'd like to manage a postgresql role like this:
postgresql::server::role { 'marmot':
password_hash => postgresql_password('marmot', 'mypasswd'),
}
In above, how can I use hiera in the function part?
I tried:
postgresql::server::role { [hiera(my::db::user)]:
password_hash => postgresql_password([hiera(my::db::user), hiera(my::db::pass)]),
}
where hiera variables:
my::db::user: 'marmot'
my::db::pass: 'mypasswd'
The error was:
Error 400 on SERVER: can't convert Array into String
I also tried a merged hiera variable as array but it didnt work either:
postgresql::server::role { [hiera(my::db::user)]:
password_hash => postgresql_password([hiera(my::db::userpass)]),
}
where i defined the hiera variable as array,
my::db::userpass:
- 'marmot'
- 'mypasswd'
But got an error like this:
Error 400 on SERVER: postgresql_password(): Wrong number of arguments given (1 for 2)
I also tried hiera_array and hiera_hash but none of them helps.
Any clues?