dash0_telemetry_transformation_rule
Manages a Dash0 telemetry transformation rule, which applies named OTTL transformations to telemetry at ingestion. Creation uses POST; updates replace an existing rule with PUT and do not create missing rules. Changing dataset destroys the rule and creates a new one with a fresh origin.
Example Usage
resource "dash0_telemetry_transformation_rule" "normalize_user_id" {
dataset = "default"
telemetry_transformation_rule_yaml = file("${path.module}/telemetry_transformation_rule.yaml")
}Save the rule below as telemetry_transformation_rule.yaml next to the Terraform configuration:
kind: Dash0TelemetryTransformationRule
metadata:
name: normalize-user-id
spec:
# Keep disabled until the transformations have been checked against your telemetry.
enabled: false
display:
name: Normalize user IDs in logs
signal: logs
context: log
priority: 200
conditions:
- 'attributes["userId"] != nil'
transformations:
- name: Copy the user ID
statements:
- 'set(attributes["user.id"], attributes["userId"])'
- 'set(attributes["user.id.normalized"], true)'
- name: Remove the legacy attribute
statements:
- 'delete_key(attributes, "userId")'
examples:
- name: Log with a legacy user ID
otlp:
resourceLogs:
- resource:
attributes:
- key: service.name
value:
stringValue: example-service
scopeLogs:
- scope:
name: example
logRecords:
- body:
stringValue: Example log
attributes:
- key: userId
value:
stringValue: example-userTransformations and their statements execute in the order written.
Stored examples are part of the managed rule, not ingested telemetry.
Keep synthetic data in examples and set spec.enabled explicitly.
The example is disabled so it does not change ingestion until you enable it.
Updates replace the whole spec. Keep spec.examples to preserve them, change them to update them, or omit them to remove them. The list API omits examples, so export existing rules with a full GET before managing them.
Schema
Required
telemetry_transformation_rule_yaml(String) The rule as YAML withkind: Dash0TelemetryTransformationRule,metadata, andspec. Setspec.enabledexplicitly, the signal and context, and namedspec.transformationswith ordered statements. Priority defaults to 200; 0, 100, 200, 300, and 400 are supported. No apiVersion is required. Storedspec.examplesare managed as part of the rule: omitting them removes them on update. Export the full rule with GET, not list, to keep examples. Server metadata does not cause drift. A supplieddash0.com/updated-atannotation is preserved for concurrency checks and a stale value fails the update. Remove that annotation from exported files for ongoing Terraform management without a fixed concurrency token. Examples persist as configuration, not retained telemetry; do not put sensitive data in them.
Optional
dataset(String) The dataset identifier, not its display name. If omitted, the provider-level dataset default is used. Changing this value replaces the rule with a new origin.
Read-Only
id(String) The server-assigned identifier of the telemetry transformation rule.origin(String) A tf_-prefixed identifier generated on creation. For imported rules, this is the origin or ID supplied at import. Used for subsequent reads, updates, and deletion.
Import
Import by origin or server-assigned ID using dataset,identifier:
#!/bin/bash
terraform import dash0_telemetry_transformation_rule.normalize_user_id default,existing-transformation-rule-originThe imported identifier remains in the origin attribute for subsequent reads, updates, and deletion.
Remove the dash0.com/updated-at annotation from exported configuration before ongoing Terraform management.
If supplied, it is a concurrency token, and a stale value causes an update error rather than overwriting another edit.
Last updated: