voxpupuli / puppet-consul

A Puppet Module to Manage Consul
Apache License 2.0
121 stars 315 forks source link

consul_prepared_query doesn't support updating #662

Open gmenuel opened 2 months ago

gmenuel commented 2 months ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

When running :

consul_prepared_query { 'consul':
  ensure               => 'present',
  service_name         => 'consul',
  service_failover_n   => 1,
  service_failover_dcs => [ 'dc1', 'dc2' ],
  service_only_passing => true,
  service_tags         => [ 'tag1', 'tag2' ],
  service_meta         => { 'version' => '1.2.3' },
  ttl                  => 10,
}

And then in another run, we change the service_failover_dcs (for exemple, I've seen the same behavior with other attributes) :

consul_prepared_query { 'consul':
  ensure               => 'present',
  service_name         => 'consul',
  service_failover_n   => 1,
  service_failover_dcs => [ 'dc1'],
  service_only_passing => true,
  service_tags         => [ 'tag1', 'tag2' ],
  service_meta         => { 'version' => '1.2.3' },
  ttl                  => 10,
}

What are you seeing

The prepared query is created during the first run, but not updated with the new attributes in the second run.

What behaviour did you expect instead

Changing attributes should be reflected in Consul.

Output log

Output of the second run:

Info: Applying configuration version '1718372736'
Debug: Prefetching default resources for consul_prepared_query
Debug: prefetching for consul
Debug: found {:name=>"consul", :id=>"a319fb62-d604-1a4d-e4b8-f54c6fbe448c", :token=>"", :service_failover_dcs=>["dc1", "dc2"], :ttl=>"10s", :service_only_passing=>false, :ensure=>:present}
Debug: Finishing transaction 12260
Debug: Storing state
Debug: Pruned old state cache entries in 0.00 seconds
Debug: Stored state in 0.00 seconds
Notice: Applied catalog in 0.02 seconds

Any additional information you'd like to impart