Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pagerduty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Who is on call for IPNI, and where pages go. The paging runbook is in

| Resource | What |
|---|---|
| Team **ipni** and its members | `pagerduty_team`, `pagerduty_user`, `pagerduty_team_membership` |
| Members | `pagerduty_user` (no team: see [Plan](#plan)) |
| Schedule **IPNI on-call** | One person at a time, a week each, handing over on Monday at 09:00 UTC, in alias order |
| Escalation policy **IPNI** | The person on call, then everyone after 15 minutes; runs twice. Was the account's "Default" policy |
| Service **Service Worker Gateway** | Paged by Cloudflare when inbrowser.link is down (`production_down_page` in `cloudflare/notifications`). Was the "Default Service" that connecting Cloudflare created; its Cloudflare integration isn't managed here |
Expand All @@ -15,6 +15,15 @@ Who is on call for IPNI, and where pages go. The paging runbook is in
State: `s3://ipni-terraform-state/pagerduty/terraform.tfstate`. CI plans and
applies it with the Cloudflare stacks (same workflow, same approval).

## Plan

We stay on PagerDuty's **Free** plan: up to 5 users, one schedule and one
escalation policy, with the API and integrations included, and 100 phone or
SMS notifications a month (push through the app isn't capped). Teams are a
paid feature, so nothing here uses one: who is paged comes from the schedule
and the escalation policy. The team `ipni` created in the UI is no longer
managed by Terraform. A 6th person, or a second rotation, needs a paid plan.

## Not managed here

- **Each person's contact methods and notification rules** (app, SMS, phone):
Expand Down
37 changes: 14 additions & 23 deletions pagerduty/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,22 @@ locals {
on_call = [for a in sort(local.aliases) : a if nonsensitive(var.members[a].on_call)]
}

# Created in the UI.
resource "pagerduty_team" "ipni" {
name = "ipni"
description = local.managed_by
# Teams are a paid feature, and we stay on the Free plan (5 users, one
# schedule, one escalation policy). Terraform no longer manages the team
# "ipni" or its memberships; they stay in PagerDuty until the plan drops them,
# and who is paged comes from the schedule and escalation policy anyway.
removed {
from = pagerduty_team.ipni
lifecycle {
destroy = false
}
}

import {
to = pagerduty_team.ipni
id = "PWRBIVW"
removed {
from = pagerduty_team_membership.member
lifecycle {
destroy = false
}
}

resource "pagerduty_user" "member" {
Expand Down Expand Up @@ -55,27 +62,12 @@ import {
id = each.value
}

resource "pagerduty_team_membership" "member" {
for_each = local.aliases

team_id = pagerduty_team.ipni.id
user_id = pagerduty_user.member[each.key].id
}

import {
for_each = local.existing_users

to = pagerduty_team_membership.member[each.key]
id = "${each.value}:PWRBIVW"
}

# One person on call at a time, a week each, handing over on Monday at 09:00
# UTC, in alias order.
resource "pagerduty_schedulev2" "on_call" {
name = "IPNI on-call"
description = local.managed_by
time_zone = "Etc/UTC"
teams = [pagerduty_team.ipni.id]

# PagerDuty stores Etc/UTC as "UTC", which the provider rejects as a value,
# so every plan wanted to change it back. To change the time zone, remove
Expand Down Expand Up @@ -114,7 +106,6 @@ resource "pagerduty_escalation_policy" "ipni" {
name = "IPNI"
description = local.managed_by
num_loops = 2
teams = [pagerduty_team.ipni.id]

rule {
escalation_delay_in_minutes = 15
Expand Down
Loading