page_title | subcategory | description |
---|---|---|
grafana_dashboard_public Resource - terraform-provider-grafana |
Grafana OSS |
Manages Grafana public dashboards.
Note: This resource is available only with Grafana 10.2+.
Official documentation https://grafana.com/docs/grafana/latest/dashboards/share-dashboards-panels/shared-dashboards/HTTP API https://grafana.com/docs/grafana/next/developers/http_api/dashboard_public/ |
Manages Grafana public dashboards.
Note: This resource is available only with Grafana 10.2+.
// Optional (On-premise, not supported in Grafana Cloud): Create an organization
resource "grafana_organization" "my_org" {
name = "test 1"
}
// Create resources (optional: within the organization)
resource "grafana_folder" "my_folder" {
org_id = grafana_organization.my_org.org_id
title = "test Folder"
}
resource "grafana_dashboard" "test_dash" {
org_id = grafana_organization.my_org.org_id
folder = grafana_folder.my_folder.id
config_json = jsonencode({
"title" : "My Terraform Dashboard",
"uid" : "my-dashboard-uid"
})
}
resource "grafana_dashboard_public" "my_public_dashboard" {
org_id = grafana_organization.my_org.org_id
dashboard_uid = grafana_dashboard.test_dash.uid
uid = "my-custom-public-uid"
access_token = "e99e4275da6f410d83760eefa934d8d2"
time_selection_enabled = true
is_enabled = true
annotations_enabled = true
share = "public"
}
// Optional (On-premise, not supported in Grafana Cloud): Create an organization
resource "grafana_organization" "my_org2" {
name = "test 2"
}
resource "grafana_dashboard" "test_dash2" {
org_id = grafana_organization.my_org2.org_id
config_json = jsonencode({
"title" : "My Terraform Dashboard2",
"uid" : "my-dashboard-uid2"
})
}
resource "grafana_dashboard_public" "my_public_dashboard2" {
org_id = grafana_organization.my_org2.org_id
dashboard_uid = grafana_dashboard.test_dash2.uid
share = "public"
}
dashboard_uid
(String) The unique identifier of the original dashboard.
access_token
(String) A public unique identifier of a public dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a public dashboard.annotations_enabled
(Boolean) Set totrue
to show annotations. The default value isfalse
.is_enabled
(Boolean) Set totrue
to enable the public dashboard. The default value isfalse
.org_id
(String) The Organization ID. If not set, the Org ID defined in the provider block will be used.share
(String) Set the share mode. The default value ispublic
.time_selection_enabled
(Boolean) Set totrue
to enable the time picker in the public dashboard. The default value isfalse
.uid
(String) The unique identifier of a public dashboard. It's automatically generated if not provided when creating a public dashboard.
id
(String) The ID of this resource.
Import is supported using the following syntax:
terraform import grafana_dashboard_public.name "{{ dashboardUID }}:{{ publicDashboardUID }}"
terraform import grafana_dashboard_public.name "{{ orgID }}:{{ dashboardUID }}:{{ publicDashboardUID }}"