terraform/website/source/docs/providers/grafana/r/dashboard.html.md

1.4 KiB

layout page_title sidebar_current description
grafana Grafana: grafana_dashboard docs-influxdb-resource-dashboard The grafana_dashboard resource allows a Grafana dashboard to be created.

grafana_dashboard

The dashboard resource allows a dashboard to created on a Grafana server.

Example Usage

resource "grafana_dashboard" "metrics" {
  config_json = "${file("grafana-dashboard.json")}"
}

Dashboards can be exported from Grafana's web UI in JSON format and provided via the config_json argument.

The exported JSON will include references to Grafana data sources, but the data source configuration is not exported in this way. In order to fully manage a dashboard with Terraform, necessary data sources can be created using the grafana_data_source resource. In order to ensure that a data source is created before a dashboard that refers to it, use the depends_on meta-parameter:

    depends_on = ["grafana_data_source.metrics"]

Argument Reference

The following arguments are supported:

  • config_json - (Required) The JSON configuration for the dashboard.

Attributes Reference

The resource exports the following attributes:

  • slug - A URL "slug" for this dashboard, generated by Grafana by removing certain characters from the dashboard name given as part of the config_json argument. This can be used to generate the URL for a dashboard.