Manages the entire set of permissions for a dashboard. Permissions that aren't specified when applying this resource will be removed.
resource "grafana_team" "team" {
name = "Team Name"
}
resource "grafana_user" "user" {
email = "user.name@example.com"
password = "my-password"
login = "user.name"
}
resource "grafana_dashboard" "metrics" {
config_json = jsonencode({
"title" : "My Dashboard",
"uid" : "my-dashboard-uid"
})
}
resource "grafana_dashboard_permission" "collectionPermission" {
dashboard_uid = grafana_dashboard.metrics.uid
permissions {
role = "Editor"
permission = "Edit"
}
permissions {
team_id = grafana_team.team.id
permission = "View"
}
permissions {
user_id = grafana_user.user.id
permission = "Admin"
}
}
dashboard_id
(Number, Deprecated) ID of the dashboard to apply permissions to. Deprecated: use dashboard_uid
instead.dashboard_uid
(String) UID of the dashboard to apply permissions to.org_id
(String) The Organization ID. If not set, the Org ID defined in the provider block will be used.permissions
(Block Set) The permission items to add/update. Items that are omitted from the list will be removed. (see below for nested schema)id
(String) The ID of this resource.permissions
Required:
permission
(String) Permission to associate with item. Must be one of View
, Edit
, or Admin
.Optional:
role
(String) Name of the basic role to manage permissions for. Options: Viewer
, Editor
or Admin
.team_id
(String) ID of the team to manage permissions for. Defaults to 0
.user_id
(String) ID of the user or service account to manage permissions for. Defaults to 0
.Import is supported using the following syntax:
terraform import grafana_dashboard_permission.name "{{ dashboardUID }}"
terraform import grafana_dashboard_permission.name "{{ orgID }}:{{ dashboardUID }}"