Skip to content

Terraform Provider

The official okstatus Terraform provider lets you manage monitors, incidents, status pages, alert channels, and maintenance windows as code — useful for provisioning monitoring alongside the infrastructure it watches, or keeping a fleet of monitors in version control instead of clicking through the dashboard.

The provider is published on the Terraform Registry and its full resource/data-source reference lives there. This guide only covers getting started — see the registry docs for every field.

terraform {
required_providers {
okstatus = {
source = "clearcloud-fr/okstatus"
}
}
}
provider "okstatus" {
# api_key can also come from the OKSTATUS_API_KEY environment variable.
# api_key = "oks_live_..."
}

Prefer the environment variable over hardcoding the key in your .tf files:

Terminal window
export OKSTATUS_API_KEY="oks_live_..."
resource "okstatus_monitor" "api" {
name = "Production API"
url = "https://api.example.com/health"
type = "http"
interval = 60
regions = ["fr-dc3", "de-fra", "es-mad"]
accepted_status_codes = ["200-299"]
}

Which regions values are actually allowed depends on your plan — a region your plan doesn’t include fails at apply with a 400, not at plan. See Regions and intervals for the per-plan list.

Alert channel config uses the backend’s own field names (camelCase), not Terraform’s usual snake_case — see the okstatus_alert_channel reference for the shape of every channel type.

resource "okstatus_alert_channel" "team_discord" {
type = "discord"
config = {
webhookUrl = "https://discord.com/api/webhooks/..."
}
}
Resource / data sourceManages
okstatus_monitorHTTP, TCP, ping, and DNS monitors
okstatus_llm_monitorLLM canary monitors (Max and above)
okstatus_alert_channelEmail, Discord, webhook, Slack, Telegram, and more
okstatus_incidentIncidents and their timestamped updates
okstatus_maintenanceScheduled maintenance windows
okstatus_status_pagePublic status pages
data.okstatus_monitorsLook up existing monitors (e.g. to reference by name)
data.okstatus_orgRead the current organization’s plan and settings
data.okstatus_alert_channelsLook up existing alert channels

Full schema, every field, and defaults: registry.terraform.io/providers/clearcloud-fr/okstatus.

Resources created through the dashboard can be brought under Terraform management with terraform import, using the resource’s ID (visible in the dashboard URL or via the REST API):

Terminal window
terraform import okstatus_monitor.api <monitor-id>