voxpupuli / puppet-grafana

Puppet module to manage Grafana
Apache License 2.0
15 stars 106 forks source link

grafana_datasource created on every puppet run #372

Open dlucredativ opened 2 months ago

dlucredativ commented 2 months ago

Given

['Foo', 'Bar'].each |$source| {
    grafana_datasource { $source:
      organization => $source,
      [...]
    }
}

Puppet "creates" those resources on every run.

Notice: /Stage[main]/Main/Grafana_datasource[Foo]/ensure: created
Notice: /Stage[main]/Main/Grafana_datasource[Bar]/ensure: created

Unlike https://github.com/voxpupuli/puppet-grafana/issues/289, the provider does not see an existing datasource at all. This is because the API call in datasource_by_name only returns datasources for the current organization, but said method does not switch the current organization as flush does.