This repository contains a webhook, implemented using CloudFlare Workers, which will extract an environment value from the incident title upon incident creation and store the value in a custom field named environment
.
- Ensure that you have a Custom Field set up with the name
environment
, a Schema created containing that Field and that the Schema is assigned to the relevant Services in your PagerDuty account. - Create a read-write PagerDuty REST API Key.
- Create a webhook with the expected URL of the webhook. Make note of the generated secret.
- Deploy the worker by running
npm run deploy:production
- Use wrangler to set these two secrets:
PD_API_KEY
- The REST API KeyPD_WEBHOOK_SECRET
- The secret for the webhook
For example:
$ wrangler secret put PD_API_KEY
Once done, wrangler secret list
should show the following:
[
{
"name": "PD_API_KEY",
"type": "secret_text"
},
{
"name": "PD_WEBHOOK_SECRET",
"type": "secret_text"
}
]
This webhook can optionally emit events to AWS EventBridge and have those events routed to AWS CloudWatch. To activate this:
- Copy
terraform.tfvars.sample
toterraform.tfvars
and edit as necessary. - Run
terraform plan
andterraform apply
- Run
setup-logging-variables-prod.sh
to create the relevant secrets in Cloudflare Workers.
This will create a Log Group named /aws/events/extract-environment-from-title-webhook.prod
(unless you've changed the event_source
variable name)