Skip to main content

workspace_service_accounts

Creates, updates, deletes, gets or lists a workspace_service_accounts resource.

Overview

Nameworkspace_service_accounts
TypeResource
Idaws.grafana.workspace_service_accounts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique ID of the service account.
namestringThe name of the service account.
grafana_rolestringThe role of the service account, which sets the permission level used when calling Grafana APIs. (ADMIN, EDITOR, VIEWER)
is_disabledstringReturns 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:

NameAccessible byRequired ParamsOptional ParamsDescription
list_workspace_service_accountsselectworkspace_id, regionmaxResults, nextTokenReturns 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_accountinsertworkspace_id, region, name, grafanaRoleCreates 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_accountdeleteservice_account_id, workspace_id, regionDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
service_account_idstringThe ID of the service account to delete.
workspace_idstringThe ID of the workspace where the service account resides.
maxResultsintegerThe maximum number of service accounts to include in the results.
nextTokenstringThe token for the next set of service accounts to return. (You receive this token from a previous ListWorkspaceServiceAccounts operation.)

SELECT examples

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

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
;

DELETE examples

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
;