Last updated:
dash0_slo
Terraform resource for Dash0 service level objectives (SLOs) defined in the OpenSLO format.
Manages a Dash0 Service Level Objective (SLO). SLOs define a reliability target for a service, measured against a service level indicator (SLI) derived from telemetry, using OpenSLO v1 documents. See SLOs and Manage SLOs as Code for more details.
Example Usage
terraform
resource "dash0_slo" "checkout_availability" {
dataset = "default"
slo_yaml = file("${path.module}/slo.yaml")
}
# Inline OpenSLO v1 document. Dash0 supports a constrained subset of OpenSLO:
# a single objective, an inline `ratioMetric` indicator, `Occurrences`
# budgeting, and a rolling 28d (4w) window.
resource "dash0_slo" "checkout_latency" {
dataset = "default"
slo_yaml = <<-YAML
apiVersion: openslo.com/v1
kind: SLO
metadata:
name: checkout-latency
annotations:
dash0.com/display-name: Checkout latency
dash0.com/enabled: "true"
spec:
description: 99 percent of checkout HTTP requests complete under 500ms over a rolling 28-day window.
service: checkout
budgetingMethod: Occurrences
timeWindow:
- duration: 28d
isRolling: true
indicator:
metadata:
name: checkout-latency-ratio
spec:
ratioMetric:
counter: true
good:
metricSource:
type: Prometheus
spec:
query: 'http_server_request_duration_seconds_bucket{service_name="checkout",le="0.5"}'
total:
metricSource:
type: Prometheus
spec:
query: 'http_server_request_duration_seconds_count{service_name="checkout"}'
objectives:
- displayName: 99% under 500ms
target: 0.99
YAML
}Schema
Required
slo_yaml(String) The SLO definition in OpenSLO v1 YAML format (apiVersion: openslo.com/v1,kind: SLO), specifying the objective target, service level indicator, budgeting method, and time window. See Create SLOs for the available options. Changes to user-defined labels and annotations, and to thedash0.com/display-name,dash0.com/enabled,dash0.com/folder-pathanddash0.com/sharingannotations, trigger a resource update; a missingdash0.com/enabledannotation counts as"true". Labels and annotations with any otherdash0.com/key are managed by the server and ignored during drift detection.
Optional
dataset(String) The identifier of the Dash0 dataset that the SLO belongs to. Provide the dataset's identifier, which is immutable, not the 'name'. Datasets are used to separate observability data within a Dash0 organization. If omitted, the provider-leveldatasetdefault is used (see the provider'sdatasetattribute). Changing this value forces the resource to be recreated.
Read-Only
id(String) The server-assigned UUID of the SLO, resolved by the provider after creation. Reference this value when wiring the SLO's identifier into another resource.origin(String) A unique identifier for the SLO, automatically generated on creation. Used to reference the SLO for updates, reads, deletes, and imports.url(String) The URL to open this SLO in the Dash0 web app, derived from the Dash0 API URL and the SLO's server-assigned identifier. Computed by the provider after creation. May be empty if the app URL cannot be derived (e.g. for self-hosted deployments with a custom web app domain).
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
shell
#!/bin/bash
terraform import dash0_slo.name "{{ dataset }},{{ id_or_origin }}"