Skip to content

Commit

Permalink
ORCA-4807 - document the escalation_policy action (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenapan authored Jul 9, 2024
1 parent 1a2be70 commit 62a2a49
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion website/docs/r/event_orchestration_global.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A [Global Orchestration](https://support.pagerduty.com/docs/event-orchestration#

This example shows creating `Team`, and `Event Orchestration` resources followed by creating a Global Orchestration to handle Events sent to that Event Orchestration.

This example also shows using `priority` [data source](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) to configure `priority` action for a rule. If the Event matches the third rule in set "step-two" the resulting incident will have the Priority `P1`.
This example also shows using the [pagerduty_priority](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) and [pagerduty_escalation_policy](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/escalation_policy) data sources to configure `priority` and `escalation_policy` actions for a rule.

This example shows a Global Orchestration that has nested sets: a rule in the "start" set has a `route_to` action pointing at the "step-two" set.

Expand All @@ -35,6 +35,10 @@ data "pagerduty_priority" "p1" {
name = "P1"
}
data "pagerduty_escalation_policy" "sre_esc_policy" {
name = "SRE Escalation Policy"
}
resource "pagerduty_event_orchestration_global" "global" {
event_orchestration = pagerduty_event_orchestration.event_orchestration.id
set {
Expand All @@ -59,6 +63,15 @@ resource "pagerduty_event_orchestration_global" "global" {
drop_event = true
}
}
rule {
label = "If the DB host is running out of space, then page the SRE team"
condition {
expression = "event.summary matches part 'running out of space'"
}
actions {
escalation_policy = data.pagerduty_escalation_policy.sre_esc_policy.id
}
}
rule {
label = "If there's something wrong on the replica, then mark the alert as a warning"
condition {
Expand Down Expand Up @@ -112,6 +125,7 @@ The following arguments are supported:
* `suppress` - (Optional) Set whether the resulting alert is suppressed. Suppressed alerts will not trigger an incident.
* `suspend` - (Optional) The number of seconds to suspend the resulting alert before triggering. This effectively pauses incident notifications. If a `resolve` event arrives before the alert triggers then PagerDuty won't create an incident for this alert.
* `priority` - (Optional) The ID of the priority you want to set on resulting incident. Consider using the [`pagerduty_priority`](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) data source.
* `escalation_policy` - (Optional) The ID of the Escalation Policy you want to assign incidents to. Event rules with this action will override the Escalation Policy already set on a Service's settings, with what is configured by this action.
* `annotate` - (Optional) Add this text as a note on the resulting incident.
* `incident_custom_field_update` - (Optional) Assign a custom field to the resulting incident.
* `id` - (Required) The custom field id
Expand Down
16 changes: 15 additions & 1 deletion website/docs/r/event_orchestration_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A [Service Orchestration](https://support.pagerduty.com/docs/event-orchestration

This example shows creating `Team`, `User`, `Escalation Policy`, and `Service` resources followed by creating a Service Orchestration to handle Events sent to that Service.

This example also shows using `priority` [data source](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) to configure `priority` action for a rule. If the Event matches the first rule in set "step-two" the resulting incident will have the Priority `P1`.
This example also shows using the [pagerduty_priority](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) and [pagerduty_escalation_policy](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/escalation_policy) data sources to configure `priority` and `escalation_policy` actions for a rule.

This example shows a Service Orchestration that has nested sets: a rule in the "start" set has a `route_to` action pointing at the "step-two" set.

Expand Down Expand Up @@ -70,6 +70,10 @@ data "pagerduty_priority" "p1" {
name = "P1"
}
data "pagerduty_escalation_policy" "sre_esc_policy" {
name = "SRE Escalation Policy"
}
resource "pagerduty_event_orchestration_service" "www" {
service = pagerduty_service.example.id
enable_event_orchestration_for_service = true
Expand Down Expand Up @@ -116,6 +120,15 @@ resource "pagerduty_event_orchestration_service" "www" {
}
}
}
rule {
label = "If any of the API apps are unavailable, page the SRE team"
condition {
expression = "event.custom_details.service_name matches part '-api' and event.custom_details.status_code matches '502'"
}
actions {
escalation_policy = data.pagerduty_escalation_policy.sre_esc_policy.id
}
}
rule {
label = "If there's something wrong on the canary let the team know about it in our deployments Slack channel"
condition {
Expand Down Expand Up @@ -184,6 +197,7 @@ The following arguments are supported:
* `suppress` - (Optional) Set whether the resulting alert is suppressed. Suppressed alerts will not trigger an incident.
* `suspend` - (Optional) The number of seconds to suspend the resulting alert before triggering. This effectively pauses incident notifications. If a `resolve` event arrives before the alert triggers then PagerDuty won't create an incident for this alert.
* `priority` - (Optional) The ID of the priority you want to set on resulting incident. Consider using the [`pagerduty_priority`](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) data source.
* `escalation_policy` - (Optional) The ID of the Escalation Policy you want to assign incidents to. Event rules with this action will override the Escalation Policy already set on a Service's settings, with what is configured by this action.
* `annotate` - (Optional) Add this text as a note on the resulting incident.
* `incident_custom_field_update` - (Optional) Assign a custom field to the resulting incident.
* `id` - (Required) The custom field id
Expand Down

0 comments on commit 62a2a49

Please sign in to comment.