Last updated:
dash0_auth_token
Manages a Dash0 auth token. Auth tokens are organization-level credentials for the Dash0 API and for telemetry ingestion.
Managing auth tokens requires an admin user or an auth token with the * action and no dataset or signal restriction. Any other token receives a 403.
The secret is stored in the Terraform state in plain text, in the sensitive token attribute. Protect the state accordingly.
The secret is only available for tokens created by Terraform. Imported tokens have a null token.
Dash0 refuses to delete the last auth token of an organization. Destroying it fails with the API error.
The secret is generated by Dash0, returned only when the token is created, and cannot change. Imported tokens have no secret in the state. To rotate it without downtime, add a second resource, move the consumers to its secret, and remove the old resource in a later apply. The name, actions, and dataset and signal restrictions update in place. The origin cannot change.
Example Usage
# Manage a Dash0 auth token declaratively. Auth tokens are organization-level
# credentials for telemetry ingestion and the Dash0 API.
#
# Managing auth tokens requires an admin user or a token with the `*` action
# and no dataset or signal restriction.
#
# Do not set spec.token. Dash0 generates the secret; read it from the
# sensitive `token` attribute. The secret is stored in the Terraform state in
# plain text.
resource "dash0_auth_token" "ingest" {
auth_token_yaml = <<-YAML
apiVersion: dash0.com/v1alpha1
kind: Dash0AuthToken
metadata:
name: Production ingestion
spec:
# ingest:* is the "Ingesting" option in the Dash0 UI.
actions:
- ingest:*
# Limit the signals with scope.signals (the "Signal types" field in the UI).
scope:
signals:
restriction: restricted
types:
- logs
- metricDataPoints
- spans
YAML
}
# The secret, for example to configure an OpenTelemetry Collector.
output "ingest_token" {
value = dash0_auth_token.ingest.token
sensitive = true
}
# To rotate the secret without downtime, add a second dash0_auth_token
# resource, move the consumers to its secret, and remove the old resource in a
# later apply.
# You can also load the YAML definition from a file:
#
# resource "dash0_auth_token" "ingest" {
# auth_token_yaml = file("${path.module}/auth-tokens/ingest.yaml")
# }Actions
spec.actions sets what the token can do.
The valid actions are:
| Action | Dash0 UI option | Grants |
|---|---|---|
* | All permissions | Full access |
*:read | Reading | Read access to the Dash0 API |
ingest:* | Ingesting | Ingestion of all signals |
ingest:logs | Ingestion of logs | |
ingest:metrics | Ingestion of metrics | |
ingest:spans | Ingestion of spans | |
ingest:profiles | Ingestion of profiles |
There are two ways to limit the signals of an ingestion token:
- Use per-signal actions, such as
ingest:logsandingest:spans. - Use
ingest:*withspec.scope.signals, as in the example above. This is the Signal types field in the Dash0 UI.
Profiles need ingest:profiles or ingest:*.
A token without the action for a signal drops that signal's data without an error.
See Auth tokens for the permissions and signal types.
Rotating the secret
The secret cannot change in place. To rotate it without downtime, keep two tokens side by side:
- Add a second
dash0_auth_tokenresource and apply. - Move the consumers to the secret of the new token.
- Remove the old resource and apply again.
terraform apply -replace=dash0_auth_token.ingest deletes the old token in the same run, so consumers lose access until they get the new secret.
create_before_destroy only narrows that gap.
Use -replace only when downtime is acceptable.
Omitted fields
When you remove a field from auth_token_yaml, Dash0 keeps its current value and Terraform stops checking that field for drift.
To reset a field, set it to the value you want (usually the default) and keep it in the YAML.
See the Dash0 API reference for the fields and their defaults.
Destroying an auth token
Dash0 refuses to delete the last auth token of an organization. Destroying it fails with the API error. Keep at least one other auth token before you destroy it.
Schema
Required
auth_token_yaml(String) The auth token definition in YAML format, withapiVersion: dash0.com/v1alpha1,kind: Dash0AuthToken,metadata.namefor the display name, andspec.actionsfor the permissions. Optionalspecfields areingestion.defaultDataset,scope.datasets(restrictionandslugs), andscope.signals(restrictionandtypes). Omitted optional fields keep the server's values without causing a diff. Do not setspec.token: the secret is exposed through thetokenattribute.
Read-Only
id(String) The auth token ID (a UUID), assigned by Dash0.origin(String) A unique identifier for the auth token, generated by the provider on creation. Null for auth tokens imported without an origin.token(String, Sensitive) The secret of the auth token, assigned by Dash0. Use it as the bearer token or ingestion token. Dash0 returns the secret only when the token is created, so it is only available for tokens created by Terraform. Imported tokens have a nulltoken.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
#!/bin/bash
# Auth tokens are organization-scoped, so the import ID has no dataset prefix.
# Use the auth token ID (a UUID) or its origin.
terraform import dash0_auth_token.ingest 5f1c4a52-7a6e-4c4e-9d0e-3f6a1b2c3d4eDash0 returns the secret only when it creates the token, so an imported token has a null token attribute. Terraform manages it, but cannot read its secret.