Uptime/

uptime_check

Manages an Uptime monitoring check. Checks run periodically against a service to verify uptime, scan for security issues, or detect technologies.

Changing type forces replacement

The type and service_id attributes cannot be updated in-place. Changing either will destroy and recreate the check.

Uptime Check Example

HTTP health checks verify your service is responding with expected status codes and content.

main.tfhcl
resource "uptime_check" "api_health" {
  service_id       = uptime_service.api.id
  name             = "HTTP Health Check"
  type             = "uptime"
  interval_seconds = 60
  timeout_seconds  = 30

  uptime_config {
    method                = "GET"
    expected_status_codes = [200]
    verify_ssl            = true
    follow_redirects      = true
  }
}

Security Check Example

Security checks validate SSL certificates, TLS versions, and the presence of security headers.

main.tfhcl
resource "uptime_check" "api_security" {
  service_id       = uptime_service.api.id
  name             = "Security Scan"
  type             = "security"
  interval_seconds = 3600
  timeout_seconds  = 60

  security_config {
    check_ssl               = true
    check_headers           = true
    check_tls_version       = true
    ssl_expiry_warning_days = 30
    required_headers        = [
      "Strict-Transport-Security",
      "X-Content-Type-Options",
    ]
  }
}

Tech Detection Example

Technology detection identifies frameworks, CMS platforms, analytics tools, and hosting providers.

main.tfhcl
resource "uptime_check" "frontend_tech" {
  service_id       = uptime_service.frontend.id
  name             = "Tech Stack Detection"
  type             = "techdetect"
  interval_seconds = 86400
  timeout_seconds  = 60

  techdetect_config {
    detect_frameworks = true
    detect_cms        = true
    detect_analytics  = true
    detect_hosting    = true
  }
}

Top-Level Argument Reference

NameTypeStatusDescription
id
String
Computed
The unique identifier of the check.
service_id
String
Required
The ID of the service this check belongs to. Changing this forces a new resource.
name
String
Required
Human-readable name for the check.
type
String
Required
The check type. One of: "uptime", "security", "techdetect". Changing this forces a new resource.
interval_seconds
Int64
Required
How often the check runs, in seconds (30–86400).
timeout_seconds
Int64
Required
Maximum time to wait for a check response, in seconds (5–300).
enabled
Bool
Optional + Computed
Whether the check is enabled.Default: true
created_at
String
Computed
Timestamp when the check was created.
updated_at
String
Computed
Timestamp when the check was last updated.

uptime_config

Configuration for uptime (HTTP) checks.

NameTypeStatusDescription
method
String
Optional
HTTP method to use (default: GET).
headers
Map(String)
Optional
HTTP headers to send with the request.
body
String
Optional
HTTP request body.
expected_status_codes
List(Int64)
Optional
List of acceptable HTTP status codes.
expected_body_contains
String
Optional
String expected to appear in the response body.
follow_redirects
Bool
Optional
Whether to follow HTTP redirects.
verify_ssl
Bool
Optional
Whether to verify SSL certificates.

security_config

Configuration for security checks.

NameTypeStatusDescription
check_ssl
Bool
Optional
Whether to check SSL certificate validity.
check_headers
Bool
Optional
Whether to check security headers.
check_tls_version
Bool
Optional
Whether to check TLS version.
ssl_expiry_warning_days
Int64
Optional
Number of days before SSL expiry to trigger a warning.
required_headers
List(String)
Optional
List of security headers that must be present.

techdetect_config

Configuration for technology detection checks.

NameTypeStatusDescription
detect_frameworks
Bool
Optional
Whether to detect web frameworks.
detect_cms
Bool
Optional
Whether to detect content management systems.
detect_analytics
Bool
Optional
Whether to detect analytics tools.
detect_hosting
Bool
Optional
Whether to detect hosting providers.

Import

Existing checks can be imported using their UUID.

bash
terraform import uptime_check.api_health <check-uuid>