Skip to content

Commit e9934c5

Browse files
authored
Update docs for Service accounts and Grafana v10 (#273)
* Update documentation for v10 * Update SA command * Update doc
1 parent 7100649 commit e9934c5

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

docs/eks/index.md

+39-12
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,50 @@ To create a new workspace, visit [our supporting example for Grafana](https://aw
8383
export TF_VAR_managed_grafana_workspace_id=g-xxx
8484
```
8585

86-
#### 6. Grafana API Key
86+
#### 6. Grafana authentication
8787

88-
Amazon Managed Grafana provides a control plane API for generating Grafana API keys.
89-
As a security best practice, we will provide to Terraform a short lived API key to
88+
Grafana Service Accounts and Service Account Tokens have been introduced in
89+
Amazon Managed Grafana v9.4, which replaces Grafana API Keys in v10.4.
90+
Amazon Managed Grafana provides new control plane APIs to automate their creation.
91+
If you are still using a workspace in Grafana v8.4, you can use a Grafana API Key.
92+
93+
As a security best practice, we will provide Terraform a short lived token to
9094
run the `apply` or `destroy` command.
9195

92-
Ensure you have necessary IAM permissions (`CreateWorkspaceApiKey, DeleteWorkspaceApiKey`)
96+
Ensure you have necessary IAM permissions
97+
(`CreateWorkspaceServiceAccount, CreateWorkspaceServiceAccountToken, DeleteWorkspaceServiceAccounts, DeleteWorkspaceServiceAccountToken`)
98+
for Service Accounts and (`CreateWorkspaceApiKey, DeleteWorkspaceApiKey`) for Grafana API key.
99+
100+
=== "v10.4 & v9.4 workspaces"
101+
102+
```console
103+
# skip this command if you already have a service token
104+
GRAFANA_SA_ID=$(aws grafana create-workspace-service-account \
105+
--workspace-id $TF_VAR_managed_grafana_workspace_id \
106+
--grafana-role ADMIN \
107+
--name terraform-accelerator-eks \
108+
--query 'id' \
109+
--output text)
110+
111+
# creates a new token for running Terraform
112+
export TF_VAR_grafana_api_key=$(aws grafana create-workspace-service-account-token \
113+
--workspace-id $TF_VAR_managed_grafana_workspace_id \
114+
--name "observability-accelerator-$(date +%s)" \
115+
--seconds-to-live 7200 \
116+
--service-account-id $GRAFANA_SA_ID \
117+
--query 'serviceAccountToken.key' \
118+
--output text)
119+
```
120+
121+
=== "v8.4 workspaces"
122+
123+
```bash
124+
export TF_VAR_grafana_api_key=`aws grafana create-workspace-api-key --key-name "observability-accelerator-$(date +%s)" --key-role ADMIN --seconds-to-live 7200 --workspace-id $TF_VAR_managed_grafana_workspace_id --query key --output text`
125+
```
93126

94127
!!! note
95-
Starting version v2.5.x and above, we use Grafana Operator and External Secrets to
96-
manage Grafana contents. Your API Key will be stored securely on AWS SSM Parameter Store
97-
and the Grafana Operator will use it to sync dashboards, folders and data sources.
98-
Read more [here](https://aws-observability.github.io/terraform-aws-observability-accelerator/concepts/).
99-
100-
```bash
101-
export TF_VAR_grafana_api_key=`aws grafana create-workspace-api-key --key-name "observability-accelerator-$(date +%s)" --key-role ADMIN --seconds-to-live 7200 --workspace-id $TF_VAR_managed_grafana_workspace_id --query key --output text`
102-
```
128+
The `grafana_api_key` variable accepts both Grafana API key or a service
129+
account token
103130

104131
## Deploy
105132

0 commit comments

Comments
 (0)