Terraform Provider
Overview
Section titled “Overview”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.
Install
Section titled “Install”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:
export OKSTATUS_API_KEY="oks_live_..."A first monitor
Section titled “A first monitor”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.
Attaching an alert channel
Section titled “Attaching an alert channel”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/..." }}What’s covered
Section titled “What’s covered”| Resource / data source | Manages |
|---|---|
okstatus_monitor | HTTP, TCP, ping, and DNS monitors |
okstatus_llm_monitor | LLM canary monitors (Max and above) |
okstatus_alert_channel | Email, Discord, webhook, Slack, Telegram, and more |
okstatus_incident | Incidents and their timestamped updates |
okstatus_maintenance | Scheduled maintenance windows |
okstatus_status_page | Public status pages |
data.okstatus_monitors | Look up existing monitors (e.g. to reference by name) |
data.okstatus_org | Read the current organization’s plan and settings |
data.okstatus_alert_channels | Look up existing alert channels |
Full schema, every field, and defaults: registry.terraform.io/providers/clearcloud-fr/okstatus.
Importing existing resources
Section titled “Importing existing resources”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):
terraform import okstatus_monitor.api <monitor-id>