Manages a single permission item for a datasource. Conflicts with the "grafana_data_source_permission" resource which manages the entire set of permissions for a datasource.
resource "grafana_team" "team" {
name = "Team Name"
}
resource "grafana_data_source" "foo" {
type = "cloudwatch"
name = "cw-example"
json_data_encoded = jsonencode({
defaultRegion = "us-east-1"
authType = "keys"
})
secure_json_data_encoded = jsonencode({
accessKey = "123"
secretKey = "456"
})
}
resource "grafana_user" "user" {
name = "test-ds-permissions"
email = "test-ds-permissions@example.com"
login = "test-ds-permissions"
password = "hunter2"
}
resource "grafana_service_account" "sa" {
name = "test-ds-permissions"
role = "Viewer"
}
resource "grafana_data_source_permission_item" "team" {
datasource_uid = grafana_data_source.foo.uid
team = grafana_team.team.id
permission = "Edit"
}
resource "grafana_data_source_permission_item" "user" {
datasource_uid = grafana_data_source.foo.uid
user = grafana_user.user.id
permission = "Edit"
}
resource "grafana_data_source_permission_item" "role" {
datasource_uid = grafana_data_source.foo.uid
role = "Viewer"
permission = "Query"
}
resource "grafana_data_source_permission_item" "service_account" {
datasource_uid = grafana_data_source.foo.uid
user = grafana_service_account.sa.id
permission = "Query"
}
datasource_uid
(String) The UID of the datasource.permission
(String) the permission to be assignedorg_id
(String) The Organization ID. If not set, the Org ID defined in the provider block will be used.role
(String) the role onto which the permission is to be assignedteam
(String) the team onto which the permission is to be assigneduser
(String) the user or service account onto which the permission is to be assignedid
(String) The ID of this resource.Import is supported using the following syntax:
terraform import grafana_data_source_permission_item.name "{{ datasourceUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
terraform import grafana_data_source_permission_item.name "{{ orgID }}:{{ datasourceUID }}:{{ type (role, team, or user) }}:{{ identifier }}"