Skip to main content
The scaling.cloud Cloud Terraform provider lets you manage your incident-response configuration as code. Define on-call schedules, escalation policies, routing policies, and working hours in HCL, review them in pull requests, and apply them through your existing Terraform workflow. The provider talks to the same public API as everything else, authenticating with an organization API key.

Full provider reference

Every argument and attribute for the provider and each resource — always matched to the released provider version — lives in the Terraform Registry documentation. The page below is a guided tour; the Registry is the complete, authoritative reference.

Install

Add the provider to your required_providers block and run terraform init:

Authentication

The provider authenticates with a scaling.cloud API key (a scl_live_… token). Create one under Settings → API keys. You can supply it two ways:
  • The SCALING_CLOUD_API_KEY environment variable (recommended — keeps the secret out of your configuration):
  • The api_key provider attribute (mark it sensitive and source it from a variable, never a literal):
The API base URL defaults to https://api.scaling.cloud. Override it with the base_url attribute or the SCALING_CLOUD_BASE_URL environment variable if you target a non-default environment.
An API key is scoped to your organization and can create, modify, and delete on-call schedules, escalation policies, and routing policies. Store it in a secrets manager or CI secret — never commit it to version control.

Resources

The provider manages four resources, which together cover your full incident-routing configuration. The examples below are illustrative — for the complete argument and attribute reference of each (including computed fields, defaults, and validation rules), follow its Registry reference link.
The provider does not yet support terraform import. Manage these resources in Terraform from creation; schedules, escalation policies, routing policies, and working hours created in the dashboard cannot currently be adopted into Terraform state.

scaling_oncall_schedule

Manages an on-call schedule with one or more rotation layers. → Registry reference

scaling_working_hours

Manages a working hours set — a named timezone plus weekly windows, referenced by escalation policy step conditions for follow-the-sun routing. The timezone lives on the set and is never inferred from a targeted schedule. → Registry reference Each window block sets days (ISO weekday numbers, 1 = Monday through 7 = Sunday), start, and end (24-hour HH:MM in the set’s timezone). At least one window is required.

scaling_escalation_policy

Manages an escalation policy as an ordered list of steps. Position is determined by the order of the step blocks. → Registry reference A step may carry an optional condition block — a working hours condition of the form { working_hours_id, when }, where when is during or outside. The step participates only while the firing instant is during/outside the referenced set’s windows; an ineligible step is skipped (never held). If every step’s condition fails, the last step is paged unconditionally. A step with no condition block is unconditional.
Omitting the condition block on a step that previously had one surfaces a diff and clears the condition on apply — it is not silently preserved. Because the condition gates who gets paged, keep it in your configuration as long as you want it enforced; a config without it is the source of truth and wins.

scaling_routing_policy

Manages a routing policy that maps each alert severity to an outcome. A complete policy always carries exactly four rule blocks — one per severity (critical, high, medium, low). → Registry reference Each rule’s outcome is one of incident, provisional_page, notification, or drop. For paging outcomes, set escalation_policy_id to the escalation policy that should handle the page; omit it to fall back to the alert’s component default.
Renaming a routing policy or editing a rule updates it in place — no resource replacement. Your organization’s seeded default routing policy cannot be deleted.
The organization default working hours designation — the set the out-of-hours paging insight classifies against — is intentionally not managed by Terraform. It is an internal organization setting; set it from organization settings in the dashboard. Terraform manages the working hours sets and the step conditions that consume them, not which set is the org default.

Learn more