Last updated:
dash0_dataset
Manages a Dash0 dataset. Datasets are organization-level resources identified by an immutable slug.
Destroying a dataset soft-deletes it. Dashboards, views, check rules, synthetic checks, recording rules, SLOs and time series aggregations are kept for 30 days; applying the same slug within that time restores them. Spam filters are not restored. After 30 days the dataset, its permissions and those assets are removed. Telemetry is removed as its retention expires.
The slug is set in metadata.labels["dash0.com/id"] and cannot change: changing it replaces the dataset (destroy, then create under the new slug). spec.permissions is not managed by this resource yet: it is ignored on create and when detecting drift. Spec settings you omit (retention, privacy, processing) keep the server's values without causing a diff.
The dataset document follows the Dash0 API dataset document (apiVersion: dash0.com/v1alpha1).
Example Usage
# Manage a Dash0 dataset declaratively. A dataset is an isolated slice of
# telemetry with its own retention, privacy, and ingestion settings.
# Datasets are organization-level resources (no dataset scope).
#
# metadata.labels."dash0.com/id" is the dataset slug. It is required and
# cannot be changed after creation; changing it destroys and re-creates the
# dataset.
#
# Destroying the resource soft-deletes the dataset. Dashboards, views, check
# rules, synthetic checks, recording rules, SLOs and time series aggregations
# are kept for 30 days; applying the same slug within that time restores them.
# Spam filters are not restored. After 30 days the dataset, its permissions and
# those assets are removed. Telemetry is removed as its retention expires.
resource "dash0_dataset" "staging" {
dataset_yaml = <<-YAML
apiVersion: dash0.com/v1alpha1
kind: Dash0Dataset
metadata:
name: Staging
labels:
dash0.com/id: staging
spec:
retention:
traces: 30d
logs: 60d
privacy:
ipAddresses:
endUser:
storage: anonymize
geoLocation:
endUser:
storage: up_to_country
redaction:
cardholderData:
enabled: true
genAi:
conversation: redact
toolCalls: disabled
errors: disabled
YAML
}
# The dataset slug, for use as the `dataset` of other resources.
output "staging_dataset_slug" {
value = dash0_dataset.staging.id
}
# You can also load the YAML definition from a file:
#
# resource "dash0_dataset" "staging" {
# dataset_yaml = file("${path.module}/datasets/staging.yaml")
# }Destroying a dataset
Destroying a dataset is a soft delete. Dashboards, views, check rules, synthetic checks, recording rules, SLOs and time series aggregations are kept for 30 days. Apply the same configuration again within that time to restore them. Spam filters are not restored. After 30 days, the dataset, its permissions and those assets are removed. Telemetry is removed as its retention expires.
To guard against an accidental destroy, add prevent_destroy to the resource:
resource "dash0_dataset" "production" {
dataset_yaml = <<-YAML
apiVersion: dash0.com/v1alpha1
kind: Dash0Dataset
metadata:
name: Production
labels:
dash0.com/id: production
spec:
retention:
traces: 30d
YAML
lifecycle {
prevent_destroy = true
}
}Schema
Required
dataset_yaml(String) The dataset definition in YAML, following the Dash0 API dataset document:apiVersion: dash0.com/v1alpha1,kind: Dash0Dataset,metadata.namefor the display name,metadata.labels["dash0.com/id"]for the slug, and optionalspecsettings (retention,privacy,processing,preferred). Server-managed metadata is stripped from the state on read.
Read-Only
id(String) The dataset slug, taken frommetadata.labels["dash0.com/id"]indataset_yaml.origin(String) A unique identifier for the dataset, generated by the provider on creation. Null for datasets imported without an origin.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
#!/bin/bash
# Datasets are organization-scoped, so the import ID is the dataset slug
# (the `dash0.com/id` label) — no dataset prefix.
terraform import dash0_dataset.staging staging