workspace_service_accounts
Creates, updates, deletes, gets or lists a workspace_service_accounts resource.
Overview
| Name | workspace_service_accounts |
| Type | Resource |
| Id | aws.grafana.workspace_service_accounts |
Fields
The following fields are returned by SELECT queries:
- list_workspace_service_accounts
| Name | Datatype | Description |
|---|---|---|
id | string | The unique ID of the service account. |
name | string | The name of the service account. |
grafana_role | string | The role of the service account, which sets the permission level used when calling Grafana APIs. (ADMIN, EDITOR, VIEWER) |
is_disabled | string | Returns true if the service account is disabled. Service accounts can be disabled and enabled in the Amazon Managed Grafana console. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_workspace_service_accounts | select | workspace_id, region | maxResults, nextToken | Returns a list of service accounts for a workspace. Service accounts are only available for workspaces that are compatible with Grafana version 9 and above. |
create_workspace_service_account | insert | workspace_id, region, name, grafanaRole | Creates a service account for the workspace. A service account can be used to call Grafana HTTP APIs, and run automated workloads. After creating the service account with the correct GrafanaRole for your use case, use CreateWorkspaceServiceAccountToken to create a token that can be used to authenticate and authorize Grafana HTTP API calls. You can only create service accounts for workspaces that are compatible with Grafana version 9 and above. For more information about service accounts, see Service accounts in the Amazon Managed Grafana User Guide. For more information about the Grafana HTTP APIs, see Using Grafana HTTP APIs in the Amazon Managed Grafana User Guide. | |
delete_workspace_service_account | delete | service_account_id, workspace_id, region | Deletes a workspace service account from the workspace. This will delete any tokens created for the service account, as well. If the tokens are currently in use, the will fail to authenticate / authorize after they are deleted. Service accounts are only available for workspaces that are compatible with Grafana version 9 and above. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
service_account_id | string | The ID of the service account to delete. |
workspace_id | string | The ID of the workspace where the service account resides. |
maxResults | integer | The maximum number of service accounts to include in the results. |
nextToken | string | The token for the next set of service accounts to return. (You receive this token from a previous ListWorkspaceServiceAccounts operation.) |
SELECT examples
- list_workspace_service_accounts
Returns a list of service accounts for a workspace. Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.
SELECT
id,
name,
grafana_role,
is_disabled
FROM aws.grafana.workspace_service_accounts
WHERE workspace_id = '{{ workspace_id }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
;
INSERT examples
- create_workspace_service_account
- Manifest
Creates a service account for the workspace. A service account can be used to call Grafana HTTP APIs, and run automated workloads. After creating the service account with the correct GrafanaRole for your use case, use CreateWorkspaceServiceAccountToken to create a token that can be used to authenticate and authorize Grafana HTTP API calls. You can only create service accounts for workspaces that are compatible with Grafana version 9 and above. For more information about service accounts, see Service accounts in the Amazon Managed Grafana User Guide. For more information about the Grafana HTTP APIs, see Using Grafana HTTP APIs in the Amazon Managed Grafana User Guide.
INSERT INTO aws.grafana.workspace_service_accounts (
name,
grafanaRole,
workspace_id,
region
)
SELECT
'{{ name }}' /* required */,
'{{ grafanaRole }}' /* required */,
'{{ workspace_id }}',
'{{ region }}'
RETURNING
id,
name,
grafana_role,
workspace_id
;
# Description fields are for documentation purposes
- name: workspace_service_accounts
props:
- name: workspace_id
value: "{{ workspace_id }}"
description: Required parameter for the workspace_service_accounts resource.
- name: region
value: "{{ region }}"
description: Required parameter for the workspace_service_accounts resource.
- name: name
value: "{{ name }}"
- name: grafanaRole
value: "{{ grafanaRole }}"
valid_values: ['ADMIN', 'EDITOR', 'VIEWER']
DELETE examples
- delete_workspace_service_account
Deletes a workspace service account from the workspace. This will delete any tokens created for the service account, as well. If the tokens are currently in use, the will fail to authenticate / authorize after they are deleted. Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.
DELETE FROM aws.grafana.workspace_service_accounts
WHERE service_account_id = '{{ service_account_id }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND region = '{{ region }}' --required
;