Dashboard provisioning with variables

How to update variables of a dashboard during provisioning?

I’m able to provision plugins, datasources with variables (jsonData), dashboardProviders and pre-load dashboards. But some of the dashboards need to populate a variable when importing. How we can do that?

ENV variables are not recognized.

Datasources allow you include the jsonData, which can easily scripted.

But dashboards does not have the jsonData option.

The documentation does not mention anything about that and cannot find examples on the internet.

hello this is correct, it is basically not possible to do this. thanks

No workarounds? Without that, provision of dashboards gets limited, as many needs variables.

Would be great if supported something like this:

      gnetId: 99999
      revision: 1
      datasource: SomeDatasource
        VAR_REGION_DEPLOYMENT: us-west-1
      gnetId: 11663
      revision: 1
      datasource: Prometheus

I do this by creating the JSON file for a dashboard, modifying it (on whatever
machine knows what variables need changing), and then uploading to the Grafana
server, either by copying directly into /var/lib/grafana/dashboards/ or by
using the HTTP API.


Thanks. I was looking to make the Grafana provisioning more useful.

When deploying an app on Kubernetes using Terraform, having everything on the dashboards/datasource YAMLs would be perfect.

Using the HTTP API, which would need a script inside a k8s job, just to update one variable field seams a dirt workaround.

Cannot use Terraform Grafana provider either.

Hope that the option to provide values for variables using Grafana provision be at least on the roadmap

1 Like

thank you please mark the question as answered

The answer is that is not possible. Next step should be an Enhancement Request. How can we create that?

I would make a feature request in the grafana/grafana repo

yes you are right @mattabrams , and link to this threat

1 Like