Skip to content

breml/terraform-provider-uptimekuma

Repository files navigation

Terraform Provider for Uptime Kuma

A Terraform provider for managing Uptime Kuma monitors and notifications through infrastructure-as-code.

Features

  • Manage HTTP/HTTPS monitors with advanced options (auth, TLS, redirects, body/header validation)
  • Create monitors for various protocols: DNS, gRPC, TCP, Push, Ping, PostgreSQL, Redis, Real Browser
  • Monitor groups for organizing related monitors
  • Manage notification channels (webhook, Slack, Teams, ntfy)
  • Configure generic notifications with JSON config for custom types
  • Configure HTTP/HTTPS/SOCKS5 proxies for routing monitor requests
  • Tag monitors and notifications for organization and filtering

Dependencies

This provider uses the go-uptime-kuma-client to interact with Uptime Kuma. The capabilities are limited to the features supported by the client library. If you need a feature not yet available, first check if it's supported in the client library.

Requirements

  • Terraform >= 1.0
  • Go >= 1.25 (for development)
  • Uptime Kuma instance with API access
  • Docker (for running integration tests)

Installation

The provider is available on the Terraform Registry. Configure it in your Terraform code:

terraform {
  required_providers {
    uptimekuma = {
      source  = "breml/uptimekuma"
      version = "~> 0.1"
    }
  }
}

provider "uptimekuma" {
  endpoint = "http://localhost:3001"
  username = "admin"
  password = "password"
}

Quick Start

Create an HTTP Monitor

resource "uptimekuma_monitor_http" "example" {
  name     = "Example API"
  url      = "https://api.example.com/health"
  interval = 60
  timeout  = 30
  active   = true
}

Create a Webhook Notification

resource "uptimekuma_notification_webhook" "example" {
  name     = "Slack Webhook"
  url      = "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
  method   = "POST"
  is_active = true
}

Create a Proxy

resource "uptimekuma_proxy" "example" {
  host     = "proxy.example.com"
  port     = 8080
  protocol = "http"
  active   = true
}

Supported Resources

Monitors

  • uptimekuma_monitor_http - HTTP/HTTPS monitoring
  • uptimekuma_monitor_http_keyword - HTTP monitoring with keyword detection
  • uptimekuma_monitor_http_json_query - HTTP monitoring with JSON query validation
  • uptimekuma_monitor_grpc_keyword - gRPC monitoring with keyword detection
  • uptimekuma_monitor_ping - ICMP ping monitoring
  • uptimekuma_monitor_dns - DNS query monitoring
  • uptimekuma_monitor_tcp_port - TCP port connectivity
  • uptimekuma_monitor_push - Push monitoring (external push events)
  • uptimekuma_monitor_postgres - PostgreSQL database monitoring
  • uptimekuma_monitor_redis - Redis database monitoring
  • uptimekuma_monitor_real_browser - Browser-based monitoring
  • uptimekuma_monitor_group - Monitor groups for organization

Notifications

  • uptimekuma_notification - Generic notification with JSON config
  • uptimekuma_notification_webhook - Webhook notifications
  • uptimekuma_notification_slack - Slack integration
  • uptimekuma_notification_teams - Microsoft Teams integration
  • uptimekuma_notification_ntfy - ntfy.sh notifications

Proxies

  • uptimekuma_proxy - HTTP/HTTPS/SOCKS5 proxy configuration

Other

  • uptimekuma_tag - Tags for organizing monitors and notifications

Documentation

Full documentation including all resource attributes and examples is available on the Terraform Registry.

Development

Building

task build

Running Tests

# Unit tests
task test

# Acceptance tests (requires Uptime Kuma instance)
task testacc

Generating Documentation

task generate-docs

Code Quality

task format      # Format code
task lint     # Run linters

Contributing

Contributions are welcome! Please ensure:

  • Code is formatted with task format
  • Code passes linting with task lint
  • Tests pass with task test and task testacc
  • Documentation is updated with task generate-docs

License

This provider is licensed under the Mozilla Public License Version 2.0. See the LICENSE file for details.

Support

For issues, feature requests, or questions, please use the GitHub repository.