Terraform Provider
Manage Ionhour projects, HTTP checks, and heartbeat jobs as code with the official Terraform provider: install, credentials, complete module, import and state.
The official Ionhour provider, ionhour/ionhour on the Terraform Registry, manages projects, HTTP checks, and heartbeat jobs through the Checks & Jobs surface of the Integration API. Everything you can create with terraform apply reads back from GET /api/v1 in the same shape, so plans stay clean and imports are exact.
The full attribute reference for every resource and data source is generated from the provider schema and lives on the registry. This page covers setup, credentials, a complete working module, and the behaviours that matter when you run it for real.
Install
Declare the provider and pin a version range. Terraform downloads the signed release from the registry on init.
terraform {
required_version = ">= 1.5"
required_providers {
ionhour = {
source = "ionhour/ionhour"
version = "~> 0.1"
}
}
}
provider "ionhour" {}The provider block can stay empty: credentials come from the environment.
Credentials
Use a service key so the configuration belongs to the workspace rather than to a person. Create one under Workspace settings → Access Tokens with:
serviceRoleMEMBER for create and update. Deleting checks, jobs, or projects needs ADMIN.- READ_WRITE access to the
mcp:projects,mcp:checks, andmcp:jobsresources. Withoutmcp:jobswrite access,ionhour_job.ping_tokenandping_urlread back asnull.
Export it before running Terraform:
export IONHOUR_API_KEY=ionh_...| Provider attribute | Environment variable | Default |
|---|---|---|
api_key (sensitive) | IONHOUR_API_KEY | none, required |
base_url | IONHOUR_API_BASE_URL | https://api.ionhour.com/api |
On configure the provider calls GET /v1/whoami. An invalid, expired, or inactive key fails the run immediately with the API error code, and a valid one logs the workspace it acts on at TF_LOG=INFO. See Authentication for key kinds and permission levels.
A complete module
One project, two HTTP checks with different strictness, and one nightly heartbeat job:
variable "environment" {
type = string
default = "production"
}
resource "ionhour_project" "storefront" {
name = "Storefront (${var.environment})"
description = "Managed by Terraform"
}
# Defaults: GET, every 300 s, 200-399 passes, environment default regions.
resource "ionhour_check" "homepage" {
name = "Homepage"
slug = "storefront-homepage-${var.environment}"
project_id = ionhour_project.storefront.id
config = {
url = "https://www.example.com/"
}
}
resource "ionhour_check" "checkout_api" {
name = "Checkout API"
slug = "storefront-checkout-${var.environment}"
project_id = ionhour_project.storefront.id
interval_seconds = 60
grace_seconds = 10
down_severity = "P1"
late_severity = "P2"
config = {
url = "https://api.example.com/checkout/health"
method = "GET"
timeout_ms = 5000
expected_status_min = 200
expected_status_max = 299
follow_redirects = false
fail_after_consecutive = 2
body_contains = "ok"
}
}
resource "ionhour_job" "order_export" {
name = "Nightly order export"
slug = "storefront-order-export-${var.environment}"
project_id = ionhour_project.storefront.id
interval_seconds = 86400
grace_seconds = 3600
}
# The ping URL is a credential: anyone holding it can report the job healthy.
output "order_export_ping_url" {
value = ionhour_job.order_export.ping_url
sensitive = true
}terraform init && terraform applyGive checks and jobs a slug when they are managed as code. Slugs are stable, human-readable handles for slug pings and for terraform import, and they stop an auto-provisioned job from being replaced by a later apply.
Resources and data sources
| Name | Kind | What it manages or reads |
|---|---|---|
ionhour_project | resource | Name and description. Deleting a project that still holds monitors fails with PROJECT_NOT_EMPTY. |
ionhour_check | resource | Outbound HTTP check: schedule, grace, severities, and a config object for URL, method, headers, timeout, expected status range, regions, redirects, failure thresholds, latency and TLS-expiry alerts, and body assertions. |
ionhour_job | resource | Heartbeat job: interval, grace, severities, optional slug. Exposes ping_token and ping_url as sensitive attributes. |
ionhour_regions | data source | The probe regions this environment serves. |
ionhour_project | data source | Look up a project by id or exact name. |
ionhour_check | data source | Look up a check by id or slug. |
ionhour_job | data source | Look up a job by id or slug. |
Version 0.1 manages HTTP checks only. Reading or importing a check of another type fails with an error instead of planning a replacement.
Import
Checks and jobs import by numeric id or by slug:<slug>; projects import by numeric id.
terraform import ionhour_project.storefront 42
terraform import ionhour_check.homepage slug:storefront-homepage-production
terraform import ionhour_job.order_export slug:storefront-order-export-productionSet slug in the configuration before importing an auto-provisioned job. Otherwise the next apply clears the slug and slug-mode pings stop resolving.
Behaviour to know
- No perpetual diffs. Every server default is mirrored as a schema default, so an attribute you leave unset never shows a change. Removing an attribute clears it or resets it to its default.
- What forces replacement.
config.urlandcheck_typereplace the check.project_idmoves a check or job in place, and a moved job keeps its ping token. - Header names.
config.custom_headerskeys are sent lowercased; the spelling you wrote is kept in state. - Drift. A resource deleted outside Terraform is dropped from state on refresh and recreated on the next apply.
- Rate limits. A
429waits itsRetry-Afterand is retried within a five-minute budget per call, so a large apply with parallel resources survives a 60-requests-per-minute plan. Every create sends a freshIdempotency-Key, so a retried create never duplicates a monitor.
State holds secrets. ionhour_job.ping_token, ping_url, and config.custom_headers are marked sensitive but
are stored in Terraform state in plain text. Use an encrypted remote backend.
Reference
- Registry documentation: the generated schema reference for the provider, every resource, and every data source.
- Source and releases: the public repository, changelog, and GPG-signed release artifacts.
- Checks & Jobs: the API contract underneath the provider, useful when reading plan output or API error codes.
Checks & Jobs
Manage projects, HTTP checks, and heartbeat jobs as code with the Integration API: create, read, patch, pause, and delete with slugs, idempotency, and errors.
Slug Pings
Send job heartbeats by slug with an API key in the Authorization header, auto-create jobs on first ping, and migrate off the deprecated key-in-URL slug route.