Skip to content

Latest commit

 

History

History
105 lines (80 loc) · 3.6 KB

dashboard_public.md

File metadata and controls

105 lines (80 loc) · 3.6 KB
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/

grafana_dashboard_public (Resource)

Manages Grafana public dashboards.

Note: This resource is available only with Grafana 10.2+.

Example Usage

// 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"
}

Schema

Required

  • dashboard_uid (String) The unique identifier of the original dashboard.

Optional

  • 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 to true to show annotations. The default value is false.
  • is_enabled (Boolean) Set to true to enable the public dashboard. The default value is false.
  • 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 is public.
  • time_selection_enabled (Boolean) Set to true to enable the time picker in the public dashboard. The default value is false.
  • uid (String) The unique identifier of a public dashboard. It's automatically generated if not provided when creating a public dashboard.

Read-Only

  • id (String) The ID of this resource.

Import

Import is supported using the following syntax:

terraform import grafana_dashboard_public.name "{{ dashboardUID }}:{{ publicDashboardUID }}"
terraform import grafana_dashboard_public.name "{{ orgID }}:{{ dashboardUID }}:{{ publicDashboardUID }}"