Create a service account token

Terraform needs an API credential to authenticate to your Grafana instance. A service account token provides this without using your personal login. It’s a dedicated credential for automated tools.

To create a service account token, complete the following steps:

  1. Log in to your Grafana instance with an Admin account.

  2. Navigate to Administration > Users and access > Service accounts in the left-side menu.

  3. Click Add service account.

  4. Enter a name for the service account, for example terraform-deployer.

  5. Set the role to Editor (sufficient for creating and updating dashboards and folders).

  6. Click Create.

  7. On the service account detail page, click Add service account token.

  8. Enter a token name, for example terraform-token.

  9. Click Generate token.

  10. Copy the generated token and store it securely. You will not be able to see it again.

Warning

Never commit service account tokens to version control. Store them as environment variables or in a secrets manager.

What you need for the next steps

ValueExampleWhere it comes from
Grafana URLhttps://your-stack.grafana.net/Your Grafana instance URL
Service account tokenglsa_xxxxxxxxxxxxThe token you just generated

Keep both values accessible. You’ll use them to configure the Terraform provider in the next milestone.

In the next milestone, you configure the Grafana Terraform provider with these credentials.


page 3 of 8