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:
Log in to your Grafana instance with an Admin account.
Navigate to Administration > Users and access > Service accounts in the left-side menu.
Click Add service account.
Enter a name for the service account, for example
terraform-deployer.Set the role to Editor (sufficient for creating and updating dashboards and folders).
Click Create.
On the service account detail page, click Add service account token.
Enter a token name, for example
terraform-token.Click Generate token.
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
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.