Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'uid' property is not included in datasource provisioning #229

Closed
luukspierings opened this issue Nov 23, 2020 · 1 comment · Fixed by #301
Closed

'uid' property is not included in datasource provisioning #229

luukspierings opened this issue Nov 23, 2020 · 1 comment · Fixed by #301

Comments

@luukspierings
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

latest

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

-> grafana_datasource { 'Jaeger':
    uid          => 'jaeger'
    grafana_url       => $grafana_url,
    grafana_user      => $admin_user,
    grafana_password  => $admin_pw,
    type              => 'jaeger',
    url               => $jaeger_endpoint,
    access_mode       => 'proxy',
}

What are you seeing

Not the right uid being configured in Grafana for that datasource.

What behaviour did you expect instead

The datasource being provisioned with the right uid

Output log

Any additional information you'd like to impart

The Grafana documentation for provisioning a datasource includes a 'uid' property to be configured:
https://grafana.com/docs/grafana/latest/administration/provisioning/

The grafana_datasource resource is currently not open for configuring that 'uid' property, could that be added?

@joernott
Copy link

This becomes more and more urgent with grafana 9.0, as the dashboard json no longer contains a property like

"datasource": "datasource_name",

but instead something like

"datasource": {
  "type": "influxdb",
  "uid": "FaB6S62nk"
},

As grafana keeps adding the datasource to ervery graph, this now requires a lot of editing of the exported json tom replace the old code with the new one, as grafana tends to add the dashboards default data source to every single query now. And recently (9.0.7) grafana became quite creative in replacing the string with an array like

"datasource": [
 1: "d",
 2: "a",
 3: "t",
...
],

So, being able to set the uid explicitly and later reference that UID in a dashboard would make things a lot easier

alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 6, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 10, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 10, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 10, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 11, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 12, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
alexjfisher added a commit to alexjfisher/puppet-grafana that referenced this issue Oct 12, 2022
Property defaults are removed from the type and where values are needed
on datasource creation, the defaults are in the provider.

If updating an existing datasource, only properties that you want to
manage have to be specified. The API needs the post to contain several
more fields, but these can be pulled from the existing state.

`uid` is added as an optional property and, (in versions that support
it), is used when updating a datasource, (instead of updating by `id`
which has been deprecated.)

Fetching and deleting datasources by `id` has also been deprecated in
Grafana 9 so is replaced by fetching and deleting by `name`.

The managing of multiple datasources is now quicker as the previous
implementation made a number of API calls that grew exponentially with
the number of datasources.

Fixes voxpupuli#229

For users not using `basic_auth` or `password` properties in their
datasources restores idempotency when using Grafana 9 (see voxpupuli#289)

(From Grafana 9 onwards, users must use `secure_json_data` but this is
not idempotent and making it behave 100% correctly is currently
impossible as the Grafana API purposefully never exposes this data.)

There are still a number of issues open around using datasources in more
than one organization.  None of these have been addressed in this
commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants