Configuration as code
Keep teams, schedules, policies, sources and rules in a file. Review a plan, apply it, and see who is on call before and after.
On-call configuration is the thing nobody wants to click through twice, and the thing that quietly rots: a schedule that lost its last person, a policy that points at someone who left. Keep it in a file, review changes like code, and let the tool apply them.
There are two ways, and they do the same job:
treason planandtreason apply: one file, no other tools. The plan shows who is on call before and after a rotation change.- The Terraform provider: if your infrastructure already lives in Terraform.
#treason plan and treason apply
treason export > treason.yaml # start from what you have today
treason plan -f treason.yaml # what would change. Changes nothing.
treason apply -f treason.yaml --yes # make it soapply without --yes only shows the plan. Nothing is deleted unless you pass --prune, so a file that describes only part of your setup is safe: things it does not mention are left alone. plan --check exits 2 when the live setup has drifted from the file, for a CI job.
org:
flapThreshold: 4
users:
- { name: Ana Lopez, email: ana@example.com, timezone: America/New_York, role: admin }
- { name: Bo Chen, email: bo@example.com }
teams:
- name: Payments
members: [ana@example.com, bo@example.com]
schedules:
- name: Payments primary
team: Payments
timezone: America/New_York
layers:
- rotationStart: 2027-01-04T14:00:00Z
rotationLength: 7d
handoffTime: "09:00"
members: [ana@example.com, bo@example.com]
policies:
- team: Payments
repeatCount: 1
steps:
- delay: 5m
targets: ["schedule:Payments primary"]
- delay: 10m
targets: ["user:bo@example.com", "team:Payments"]
integrations:
- { name: Prod Datadog, kind: inbound, source: datadog, team: Payments }
heartbeats:
- { name: nightly-backup, every: 1d, grace: 15m, priority: P1, team: Payments }
routingRules:
- name: Staging is quiet
conditions: [{ field: tag, op: is, value: "env:staging" }]
actions: { setPriority: P5 }
maintenanceWindows:
- name: Weekly deploy
team: Payments
recurrence: { days: [2], time: "14:00", durationMinutes: 60, timezone: UTC }Everything is matched by name (people by email, or by name), and referred to by name: a policy says schedule:Payments primary, not an id. Durations are 30s, 5m, 2h, 1d, 1w.
#A plan you can read
~ schedule "Payments primary" (layers)
on call 2027-01-12 00:00 UTC: Ana Lopez → Bo Chen
on call 2027-01-15 00:00 UTC: Bo Chen → Ana Lopez
~ team "Payments" (members)
- Cy Dahl
+ heartbeat "nightly-backup"
every 1d
Plan: 1 to create, 2 to change, 0 to delete.A schedule change is shown as who is on call now, tomorrow, in three days and in a week, before and after, computed by the server from the real schedule (with its existing overrides). A reviewer sees "Thursday 09:00 is Bo, not Ana", not a diff of rotation fields.
#What it manages, and what it does not
Managed: organization settings, people, teams and their members, schedules, one escalation policy per team, integrations (name, team, settings, enabled), heartbeats, routing rules (in the file's order), maintenance windows.
Not managed, on purpose:
- Phone numbers and the mobile app. A number has to be verified by a code the person receives, and the app is paired by the person. A file cannot do either.
- Overrides, cover requests and handoff notes. They are made by people at run time and are kept when a schedule is changed here.
- Integration keys. They are created with the integration and shown once in the output of
apply. Save them then.
#Safe by construction
- Idempotent.
export, thenplan, shows no changes. Runapplytwice and the second is a no-op. - Ordered. People before teams, teams before schedules, schedules before policies. Deletes (with
--prune) go the other way, so nothing is removed while something still points at it. - Stops at the first failure, says how far it got, and re-running continues where it stopped.
- Nothing changes that cannot. An integration's kind cannot change; the plan marks it
BLOCKEDbefore touching anything. - Mistakes are named. An unknown person, team or duration is reported with where it is (
schedules[0].layers[1].members[2]), all at once.
#The Terraform provider
terraform {
required_providers {
treason = { source = "treason-app/treason" }
}
}
provider "treason" {} # TREASON_API_KEY (an admin key) and TREASON_API_URL from the environment
resource "treason_user" "ana" {
name = "Ana Lopez"
email = "ana@example.com"
}
resource "treason_team" "payments" {
name = "Payments"
member_ids = [treason_user.ana.id]
}
resource "treason_schedule" "primary" {
name = "Payments primary"
team_id = treason_team.payments.id
timezone = "America/New_York"
layer {
rotation_start = "2027-01-04T14:00:00Z"
rotation_length_days = 7
handoff_time = "09:00"
members = [treason_user.ana.id]
}
}
resource "treason_escalation_policy" "payments" {
name = "Payments policy"
team_id = treason_team.payments.id
step {
delay_minutes = 5
target {
type = "schedule"
id = treason_schedule.primary.id
}
}
}
resource "treason_integration" "datadog" {
name = "Prod Datadog"
kind = "inbound"
source = "datadog"
team_id = treason_team.payments.id
}
# treason_integration.datadog.inbound_url is the URL to give Datadog (sensitive)
resource "treason_heartbeat" "backup" {
name = "nightly-backup"
interval_seconds = 86400
grace_seconds = 900
priority = "P1"
team_id = treason_team.payments.id
}| Resource or data source | Manages |
|---|---|
treason_user, treason_team | People and teams. Destroying a person archives them. |
treason_schedule | Rotation layers (layer blocks). Overrides and cover are kept. |
treason_escalation_policy | step blocks with target blocks. One per team. |
treason_integration | Alert sources. inbound_url and key are sensitive outputs. |
treason_heartbeat | Dead-man's switches, identified by name. |
treason_routing_rule | A rule, with conditions_json and actions_json (jsonencode). Rules run in creation order; chain them with depends_on to control it. |
treason_maintenance_window | One-off or recurrence_json. |
data.treason_user | Look up an existing person by email or name. |
data.treason_oncall | Who is on call for a team when Terraform runs. |
A resource deleted outside Terraform is noticed and planned again. An integration that has raised alerts is part of their history, so destroying it disables it (and says so) instead of deleting it.
The provider is tested against a real Terraform and a real API: create, an idempotent second plan, a targeted change, drift repair and destroy. It is not yet published to the Terraform Registry (that needs a signed release); build it from terraform/ in the repository with go build.