---
title: "uptimeify_im_routing_rule"
description: "An Incident Management routing rule: incidents whose alert matches go to team_id. Rules run in ascending priority. Incident Management must be active for the organization. Import with the numeric id."
---

An Incident Management routing rule: incidents whose alert matches go to `team_id`. Rules run in ascending `priority`. Incident Management must be active for the organization. Import with the numeric id.

## Example Usage

```terraform
# Critical database alerts from Grafana go to the DBA team as sev1.
resource "uptimeify_im_routing_rule" "db" {
  team_id  = 9
  priority = 10
  match = {
    source_ids    = [tonumber(uptimeify_im_alert_source.grafana.id)]
    severity      = ["sev1", "sev2"]
    tags          = ["db"]
    field_matches = { env = "prod" }
  }
  severity_override = "sev1"
}

# Catch-all at the end.
resource "uptimeify_im_routing_rule" "default" {
  team_id  = 7
  priority = 1000
}
```

## Schema

### Required

- `team_id` (Number) The team that receives matching incidents.

### Optional

- `match` (Attributes) What the rule matches; all set fields must match. Unset or `{}` = catch-all. All ids must belong to the organization. (see [below for nested schema](#nested-schema-for-match))
- `priority` (Number) Lower runs first. Default `100`.
- `severity_override` (String) Unset = keep the mapped severity.

### Read-Only

- `created_at` (String)
- `id` (String) Numeric rule id.
- `organization_id` (Number)
- `updated_at` (String)

### Nested Schema for `match`

Optional:

- `customer_ids` (List of Number) Customer ids. At most 500.
- `field_matches` (Map of String) Payload field -> expected value, at most 50 entries.
- `monitor_ids` (List of Number) Ids of any monitor type (website, DNS, ICMP, ...). At most 500.
- `severity` (List of String) `sev1` to `sev4`.
- `source_ids` (List of Number) Alert source ids. At most 500.
- `tags` (List of String) Alert tags. At most 200.

## Import

Import is supported using the following syntax:

The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:

```shell
terraform import uptimeify_im_routing_rule.db 17
```
