Last updated:
dash0_deployment_event
Sends a deployment event to Dash0, marking the point in time at which a service was deployed.
Deployment events can be overlaid on charts as dashboard annotations, which is what makes "what changed just before this graph moved?" answerable.
Attach it to a resource with a lifecycle action_trigger block, or invoke it on its own with terraform apply -invoke.
Requires the otlp_url provider attribute (or the DASH0_OTLP_URL environment variable).
Requires a static auth_-prefixed auth token: the Dash0 OTLP/HTTP ingress endpoint this action sends to does not accept OAuth access tokens, so credentials resolved from an OAuth-enabled dash0 CLI profile fail with an actionable error.
Actions require Terraform 1.14 or later.
Example Usage
# Deployment events mark the point in time at which a service was deployed, and
# can be overlaid on charts as dashboard annotations. Sending them requires the
# provider's `otlp_url` attribute (or the DASH0_OTLP_URL environment variable).
action "dash0_deployment_event" "release" {
config {
service_name = "checkout-api"
service_version = var.image_tag
deployment_environment_name = "production"
deployment_status = "succeeded"
vcs_repository_url = "https://github.com/acme/checkout-api"
vcs_ref_head_revision = var.git_sha
vcs_ref_head_name = "main"
dataset = "production"
}
}
# Attach the event to whatever resource actually represents the deployment. The
# action runs only when Terraform changed something, which is exactly when a
# deployment happened.
resource "kubernetes_deployment" "checkout_api" {
# ... deployment configuration ...
lifecycle {
action_trigger {
events = [after_create, after_update]
actions = [action.dash0_deployment_event.release]
}
}
}
# Bracketing a rollout takes two action instances, because one event carries one
# status. Note that Terraform has no after-failure event, so a failed apply emits
# the "started" marker and nothing else.
action "dash0_deployment_event" "started" {
config {
service_name = "checkout-api"
service_version = var.image_tag
deployment_environment_name = "production"
deployment_status = "started"
dataset = "production"
}
}
action "dash0_deployment_event" "succeeded" {
config {
service_name = "checkout-api"
service_version = var.image_tag
deployment_environment_name = "production"
deployment_status = "succeeded"
dataset = "production"
}
}
resource "kubernetes_deployment" "payments_api" {
# ... deployment configuration ...
lifecycle {
action_trigger {
events = [before_create, before_update]
actions = [action.dash0_deployment_event.started]
}
action_trigger {
events = [after_create, after_update]
actions = [action.dash0_deployment_event.succeeded]
}
}
}
# One marker per service, without repeating the configuration.
action "dash0_deployment_event" "per_service" {
for_each = toset(["checkout-api", "payments-api", "search-api"])
config {
service_name = each.value
service_version = var.image_tag
deployment_environment_name = "production"
deployment_status = "succeeded"
dataset = "production"
}
}Schema
Required
dataset(String) The identifier of the Dash0 dataset the event is sent to. Provide the dataset's identifier, which is immutable, not the 'name'.service_name(String) The name of the deployed service. Maps to theservice.nameresource attribute.
Optional
body(String) The human-readable message for the event. Defaults to a message derived fromservice_name, andservice_versionwhen set.deployment_environment_name(String) The environment deployed to, for example "production". Maps to thedeployment.environment.nameresource attribute.deployment_id(String) The identifier of the deployment, for example a CI run ID. Maps to thedeployment.idresource attribute.deployment_name(String) The name of the deployment. Maps to thedeployment.nameresource attribute.deployment_status(String) The outcome of the deployment, for example "succeeded" or "failed". Maps to thedeployment.statuslog attribute — unlike the other attributes here it describes the event rather than the deployed entity. Note that Terraform cannot report a failed deployment:action_triggerhas no after-failure event, so a failed apply emits nothing. Use the dash0 CLI or itssend-log-eventGitHub Action for failure markers.event_name(String) The event name. Defaults todash0.deployment, which is the name Dash0 recognizes as a deployment marker. Override only to emit a related, differently named event.fail_on_error(Boolean) Whether a delivery failure fails the Terraform run. Defaults tofalse: an undelivered deployment marker is reported as a warning so that a transient ingestion problem does not fail a deployment, and so that an action wired tobefore_createcannot block the resource it annotates. Set totruewhen the marker is load-bearing. Configuration mistakes (a missingotlp_urlor an OAuth token) always fail regardless of this setting, since none of them survive a retry.log_attributes(Map of String) Additional log record attributes, merged withdeployment_status. Dedicated attributes take precedence.resource_attributes(Map of String) Additional resource attributes, merged with the ones derived from the dedicated attributes above. Dedicated attributes take precedence, so a key set here cannot silently shadow one of them.service_namespace(String) The namespace of the deployed service. Maps to theservice.namespaceresource attribute.service_version(String) The version of the deployed service, for example an image tag or release number. Maps to theservice.versionresource attribute.severity_number(Number) The OpenTelemetry severity number (1–24). Defaults to 9 (INFO), which is what a deployment marker is.time(String) The event timestamp as an RFC3339 timestamp with optional nanoseconds (for example "2024-03-15T10:30:00.123456789Z"). Defaults to the time the action is invoked, which is normally what you want for a deployment marker.vcs_ref_head_name(String) The name of the deployed ref, for example a branch or tag name. Maps to thevcs.ref.head.namelog record attribute.vcs_ref_head_revision(String) The deployed revision, for example a commit SHA. Maps to thevcs.ref.head.revisionlog record attribute.vcs_repository_url(String) The URL of the repository the deployed revision came from. Maps to thevcs.repository.url.fulllog record attribute.