---
title: "uptimeify_im_alert_source"
description: "An Incident Management alert source (inbound integration). Incident Management must be active for the organization. Import with the numeric id; the server-minted tokens are shown by the API only once and are therefore null after an import until rotated."
---

An Incident Management alert source (inbound integration). Incident Management must be active for the organization. Import with the numeric id; the server-minted tokens are shown by the API only once and are therefore null after an import until rotated.

## Example Usage

```terraform
variable "grafana_hmac_secret" {
  type      = string
  sensitive = true
}

# Grafana webhook with the preset mapping, HMAC signature and a weekly quiet window.
resource "uptimeify_im_alert_source" "grafana" {
  team_id = 7
  name    = "Grafana production"
  type    = "grafana"

  # Write-only: never stored in state. Bump the version to send a new secret.
  hmac_secret_wo         = var.grafana_hmac_secret
  hmac_secret_wo_version = 1

  maintenance_windows = [{ days_of_week = [7], from = "02:00", to = "04:00", timezone = "Europe/Berlin" }]
}

# Custom webhook with a v2 attribute mapping and bearer auth.
resource "uptimeify_im_alert_source" "custom" {
  team_id        = 7
  name           = "Billing jobs"
  type           = "custom"
  bearer_enabled = true
  # Change to rotate the bearer token or the ingest token.
  bearer_token_rotation = "2026-10"
  ingest_token_rotation = "2026-10"

  payload_mapping = {
    default_severity = "sev3"
    attributes = [
      { key = "title", standard = true, steps = [{ kind = "extract", type = "path", expr = "job.name" }] },
      { key = "severity", standard = true, steps = [
        { kind = "extract", type = "path", expr = "level" },
        { kind = "valueMap", entries = [{ from = "fatal", to = "sev1" }, { from = "error", to = "sev2" }], fallback = "sev3" },
      ] },
    ]
  }
}

output "billing_webhook_url" {
  value     = uptimeify_im_alert_source.custom.ingest_url
  sensitive = true
}
```

## Schema

### Required

- `name` (String) 1 to 200 characters, no surrounding whitespace.
- `team_id` (Number) Team that owns incidents from this source.
- `type` (String) A preset name from `GET /api/im/sources/presets` (e.g. `zabbix`, `datadog`, `grafana`, `alertmanager`, `sentry`, `beszel`, `custom`), `api` (no webhook URL, fed by `POST /api/im/events`) or `email`. Changing it replaces the source.

### Optional

> **NOTE**: [Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments) are supported in Terraform 1.11 and later.

- `auto_resolve` (Boolean) Resolve the incident when the vendor sends a resolve. Default `true`.
- `bearer_enabled` (Boolean) Require `Authorization: Bearer <bearer_token>`. Enabling it the first time mints the token.
- `bearer_token_rotation` (String) Any value; changing it mints a new bearer token (the old one stops working at once) and enables bearer auth.
- `grouping_window_minutes` (Number) Group alerts arriving within this many minutes into one incident. Unset = group by dedup key only.
- `hmac_enabled` (Boolean) Require an HMAC signature. Enabling needs a secret: set `hmac_secret_wo` (once is enough, disabling keeps the secret stored).
- `hmac_secret_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only HMAC secret, at least 16 characters. Sent with create and whenever `hmac_secret_wo_version` changes; it also enables HMAC. A new secret replaces the old one at once (no grace period).
- `hmac_secret_wo_version` (Number) Change to resend `hmac_secret_wo`.
- `ingest_token_rotation` (String) Any value; changing it rotates the ingest token. The old token keeps working until `secondary_expires_at`.
- `maintenance_windows` (Attributes List) Recurring windows in which alerts are stored as suppressed instead of opening incidents. At most 20. (see [below for nested schema](#nested-schema-for-maintenance_windows))
- `payload_mapping` (Attributes) How a vendor payload becomes an alert. Either the v2 `attributes` list or the v1 selector fields (`title`, `severity`, `status`, ...). Unset = not managed: the server keeps its mapping (a preset type starts with the preset mapping; read it with the data source); removing the block later keeps the last mapping. An import reads the stored mapping. Must stay unset for `type = "email"` (the server builds that mapping). (see [below for nested schema](#nested-schema-for-payload_mapping))
- `url_token_enabled` (Boolean) `authMode.urlToken`. The server stores the flag; unset = not sent.

### Read-Only

- `bearer_token` (String, Sensitive) Bearer token, minted by the server when bearer auth is first enabled or rotated. The API shows it only in that answer: null after an import until `bearer_token_rotation` changes.
- `created_at` (String)
- `id` (String) Numeric source id.
- `inbound_email_address` (String, Sensitive) `type = "email"`: address to forward vendor alert emails to (contains the ingest token).
- `ingest_token` (String, Sensitive) Ingest token of the webhook URL (null for `type = "api"`). The API shows it only on create and rotation: null after an import until `ingest_token_rotation` changes.
- `ingest_url` (String, Sensitive) Webhook URL `<endpoint>/api/im/ingest/<ingest_token>` for preset sources.
- `organization_id` (Number)
- `secondary_expires_at` (String) End of the grace period of the previous ingest token after a rotation.
- `updated_at` (String)

### Nested Schema for `maintenance_windows`

Required:

- `from` (String) `HH:MM`, 24 h.
- `to` (String) `HH:MM`, 24 h.

Optional:

- `days_of_week` (List of Number) ISO weekdays, 1 = Monday to 7 = Sunday. Unset = every day.
- `timezone` (String) IANA zone. Unset = the organization zone.


### Nested Schema for `payload_mapping`

Optional:

- `attributes` (Attributes List) v2 attribute-list mapping: ordered attributes, each with a step chain. (see [below for nested schema](#nested-schema-for-payload_mappingattributes))
- `custom` (Map of String) v1: extra field -> selector.
- `dedup_key` (String) v1: selector of the dedup key.
- `default_severity` (String) Severity when the mapping yields none. The server treats unset as `sev3`.
- `email_selectors` (Map of String) email sources: field -> email selector. The server builds it on create; read here.
- `host` (String) v1: selector of the host.
- `resolve_values` (List of String) v1: status values that resolve the alert.
- `severity` (String) v1: selector of the vendor severity.
- `severity_map` (Map of String) v1: vendor value -> `sev1`..`sev4`.
- `status` (String) v1: selector of the vendor status.
- `title` (String) v1: selector of the alert title.
- `url` (String) v1: selector of the URL.

### Nested Schema for `payload_mapping.attributes`

Required:

- `key` (String)

Optional:

- `flags` (Attributes) (see [below for nested schema](#nested-schema-for-payload_mappingattributesflags))
- `standard` (Boolean) A standard alert field (title, severity, status, ...).
- `steps` (Attributes List) (see [below for nested schema](#nested-schema-for-payload_mappingattributessteps))

### Nested Schema for `payload_mapping.attributes.flags`

Optional:

- `expand` (Boolean)
- `grouped` (Boolean)
- `hidden` (Boolean)
- `image` (Boolean)


### Nested Schema for `payload_mapping.attributes.steps`

Required:

- `kind` (String) `extract` or `valueMap`.

Optional:

- `entries` (Attributes List) valueMap: from -> to pairs. (see [below for nested schema](#nested-schema-for-payload_mappingattributesstepsentries))
- `expr` (String) extract: the expression.
- `fallback` (String) valueMap: value when no entry matches.
- `type` (String) extract: `path`, `jsonpath` or `constant`.

### Nested Schema for `payload_mapping.attributes.steps.entries`

Required:

- `from` (String)
- `to` (String)

## 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
# Numeric id. ingest_token, ingest_url and bearer_token stay null until rotated.
terraform import uptimeify_im_alert_source.grafana 42
```
