Last updated: July 19, 2026
dash0_recording_rule
Terraform resource for Dash0 recording rule groups defined in the Prometheus Rule format.
Manages a Dash0 Recording Rule. Recording rules pre-compute frequently needed or computationally expensive PromQL expressions and save the results as new time series. See Manage Check Rules as Code for more details — recording rules share the same Prometheus rule format and management surface as alert check rules. The recording rule definition uses the Prometheus Rule format.
Example Usage
terraform
12345678910111213141516171819resource "dash0_recording_rule" "span_duration_p95" {dataset = "production"recording_rule_yaml = <<-EOFapiVersion: monitoring.coreos.com/v1kind: PrometheusRulemetadata:name: span-duration-aggregationsspec:groups:- name: SpanDurationAggregationsinterval: 1m0srules:- record: service_name:dash0_spans_duration:p95_5mexpr: histogram_quantile(0.95, sum by (le, service_name) (rate({otel_metric_name="dash0.spans.duration"}[5m])))labels:quantile: "0.95"EOF}
Schema
Required
dataset(String) The identifier of the Dash0 dataset that the recording rule belongs to. Provide the dataset's identifier, which is immutable, not the 'name'. Datasets are used to separate observability data within a Dash0 organization. Changing this value forces the resource to be recreated.recording_rule_yaml(String) The recording rule definition in YAML format, following the Prometheus recording rule specification.
Read-Only
id(String) The server-assigned identifier of the recording rule group, resolved by the provider after creation. The value has the formrecording_rule_group_<ulid>(a ULID, not a UUID) because recording rules live inside groups and the API addresses the whole group. Recording rules are not addressable in the Dash0 web app, so nourlis exposed.origin(String) A unique identifier for the recording rule, automatically generated on creation. Used to reference the recording rule for updates, reads, deletes, and imports.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
shell
12#!/bin/bashterraform import dash0_recording_rule.span_duration_p95 production,tf_existing-recording-rule-origin