How can I create 2 bindings between the same exchange / queue, but with multiple routing keys? This is legal and works when setup manually.
I am using create_resources after pulling the bindings from hiera:
create_resources(rabbitmq_binding, $bindings, $binding_defaults)
where the source looks like:
role::rabbitmq::bindings:
[...]
'foo.bar.exchange@foo.bar.xyz.queue@/':
routing_key: 'foo.bar.xyz.key'
' foo.bar.exchange@foo.bar.xyz.queue@/ ':
routing_key: 'foo.bar.xyz.published.key'
There's no error, but since there's a duplicate hash key, only one prevails. Just to make sure it wasn't a problem with my use of create_resources, I also tested
rabbitmq_binding { 'foo.bar.exchange@foo.bar.xyz.queue@/':
user => $admin_user,
password => $admin_pass,
destination_type => 'queue',
routing_key => 'foo.bar.xyz.key',
arguments => {},
ensure => present,
}
rabbitmq_binding { 'foo.bar.exchange@foo.bar.xyz.queue@/':
user => $admin_user,
password => $admin_pass,
destination_type => 'queue',
routing_key => 'foo.bar.xyz.published.key',
arguments => {},
ensure => present,
}
and of course there's a duplicate resource error that way.
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Rabbitmq_binding[foo.bar.exchange@foo.bar.xyz.queue@/] is already declared; cannot redeclare at /etc/puppet/modules/role/manifests/rabbitmq.pp:XXX on node foo.example.net
I tried making routing_key an array, as well as a comma-delimited string, and even space-padding the hash key (this latter I think might work if I edit the validation rules in the module), and none of that seems to work. It also doesn't seem that there's a way to set the name separately from the resource name, but let me know if I'm wrong there and there's an undocumented way to do this.