A Terraform provider for managing Uptrace monitoring resources - monitors, dashboards, and notification channels.
This provider is in early development. While I am not really using it at the moment, I'd be happy to work on it in case someone needs it. Any feedback is welcome (just create an issue)!
- Monitor Management: Create metric and error monitors with configurable thresholds and alerts
- Dashboard Creation: YAML-based dashboards with flexible grid layouts and visualizations
- Notification Channels: Support for Slack, Telegram, Mattermost, and generic webhooks
- Data Sources: Query individual monitors or filter multiple monitors by criteria
- Full CRUD Support: Complete lifecycle management for all resources
- Import Support: Import existing Uptrace resources into Terraform state
The provider supports both Uptrace Cloud (api2.uptrace.dev) and Self-Hosted Uptrace. See the Cloud API Guide for details on cloud-specific fields.
| Feature | Self-Hosted | Uptrace Cloud | Notes |
|---|---|---|---|
| Monitor Resource | ✅ Full Support | Cloud requires trend_agg_func, non-empty query, and existing metrics. Query normalization may cause state drift (#53). |
|
| Dashboard Resource | ✅ Full Support | ✅ Full Support | YAML-based dashboards work identically across both platforms. |
| Notification Channels | ✅ Full Support | ❌ Not Functional | Cloud API uses priorities (plural) field name (#54). |
| Data Sources | ✅ Full Support | ✅ Full Support | Query individual monitors or filter by criteria. |
Monitor trend_agg_func |
✅ Required | Required for cloud API (#55). Valid values: avg, sum, min, max, p50, p90, p95, p99. |
|
| Import Support | ✅ Full Support | ✅ Full Support | Import existing resources into Terraform state. |
Legend:
- ✅ Full Support - Feature works as expected
⚠️ Partial/Optional - Feature available with limitations- ❌ Not Functional - Feature not yet working (API limitation)
terraform {
required_providers {
uptrace = {
source = "riccap/uptrace"
version = "~> 0.3"
}
}
}
provider "uptrace" {
endpoint = "https://uptrace.example.com/api/v1"
token = var.uptrace_token
project_id = var.uptrace_project_id
}The provider can also be configured via environment variables:
export UPTRACE_ENDPOINT="https://uptrace.example.com/api/v1"
export UPTRACE_TOKEN="your-api-token"
export UPTRACE_PROJECT_ID="1"# Create a notification channel
resource "uptrace_notification_channel" "slack" {
name = "Engineering Alerts"
type = "slack"
params = { webhookUrl = var.slack_webhook_url }
}
# Create an error monitor
resource "uptrace_monitor" "api_errors" {
name = "High Error Rate"
type = "error"
channel_ids = [uptrace_notification_channel.slack.id]
params = {
metrics = [{ name = "span.count" }]
query = "service.name:api-gateway span.status_code:error"
max_allowed_value = 100
check_num_point = 1
}
}- Terraform Registry Docs - Full provider documentation
- OpenTofu Registry Docs - OpenTofu documentation
- Getting Started Guide - Complete introduction
- Cloud API Guide - Uptrace Cloud configuration and known issues
- Example Configurations - Real-world usage examples
Contributions are welcome! See CONTRIBUTING.md for development setup and guidelines.
- GitHub Issues - Bug reports and feature requests
- Uptrace Documentation - Uptrace platform documentation
MIT License - see LICENSE for details.