Terraform module to manage PagerDuty service resource (batteries included).
Warning
Technical PagerDuty service can't be created without a reference to an escalation policy. Make sure to create an escalation policy before creating a service.
module "example" {
source = "Tensho/service/pagerduty"
version = "1.5.0"
name = "Example"
description = "Example service managed by Terraform"
escalation_policy_id = pagerduty_escalation_policy.example.id
auto_resolve_timeout = 3600
acknowledgement_timeout = 600
auto_pause_notifications_parameters = {
enabled = true
timeout = 120
}
alert_grouping_setting = {
type = "content_based"
config = {
time_window = 300
aggregate = "all"
fields = ["summary"]
}
}
support_hours = {
type = "fixed_time_per_day"
time_zone = "Europe/London"
start_time = "09:00:00"
end_time = "17:00:00"
days_of_week = [1, 2, 3, 4, 5]
}
incident_urgency_rule = {
type = "use_support_hours"
during_support_hours = {
type = "constant"
urgency = "high"
}
outside_support_hours = {
type = "constant"
urgency = "low"
}
}
scheduled_actions = {
type = "urgency_change"
to_urgency = "high"
at = {
type = "named_time"
name = "support_hours_start"
}
}
event_orchestration = {
enable_event_orchestration_for_service = true
sets = [
{
id = "start"
rules = [
{
label = "Suppress morning alerts"
condition = {
expression = "now in Mon,Tue,Wed,Thu,Fri,Sat,Sun 06:00:00 to 07:00:00 Europe/London"
}
actions = {
suppress = true
}
}
]
}
]
catch_all = {
actions = {
route_to = "unrouted"
}
}
}
}Check out comprehensive examples in examples folder.
- PagerDuty business service
- PagerDuty service alert grouping (AIOps add-on)
- PagerDuty service graph
- PagerDuty service Slack integration
- PagerDuty service event orchestration
| Name | Version |
|---|---|
| terraform | >= 1.7.0 |
| pagerduty | ~> 3.26 |
| Name | Version |
|---|---|
| pagerduty | 3.30.1 |
No modules.
| Name | Type |
|---|---|
| pagerduty_alert_grouping_setting.default | resource |
| pagerduty_business_service.default | resource |
| pagerduty_event_orchestration_service.default | resource |
| pagerduty_service.default | resource |
| pagerduty_service_dependency.dependent | resource |
| pagerduty_service_dependency.supporting | resource |
| pagerduty_service_integration.cloudwatch | resource |
| pagerduty_service_integration.datadog | resource |
| pagerduty_service_integration.newrelic | resource |
| pagerduty_slack_connection.default | resource |
| pagerduty_vendor.cloudwatch | data source |
| pagerduty_vendor.datadog | data source |
| pagerduty_vendor.newrelic | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| acknowledgement_timeout | PagerDuty service incident acknowledged-to-triggered state change time in seconds. | string |
"null" |
no |
| alert_grouping_setting | PagerDuty service alert grouping configuration. | object({ |
null |
no |
| auto_pause_notifications_parameters | PagerDuty service transient incident auto pause before triggering (AIOps add-on). | object({ |
{ |
no |
| auto_resolve_timeout | PagerDuty service incident auto resolution time in seconds. | string |
"null" |
no |
| business | PagerDuty business service vs technical service switch. | bool |
false |
no |
| cloudwatch_integration_enabled | PagerDuty service AWS CloudWatch integration switch. | bool |
false |
no |
| datadog_integration_enabled | PagerDuty service DataDog integration switch. | bool |
false |
no |
| description | PagerDuty service description. | string |
"Managed by Terraform" |
no |
| escalation_policy_id | PagerDuty service escalation policy ID. | string |
null |
no |
| event_orchestration | PagerDuty service event orchestration configuration. | object({ |
null |
no |
| incident_urgency_rule | PagerDuty service incident urgency rule. | object({ |
null |
no |
| name | PagerDuty service name | string |
n/a | yes |
| newrelic_integration_enabled | PagerDuty service NewRelic integration switch. | bool |
false |
no |
| point_of_contact | PagerDuty business service point fo contact. | string |
null |
no |
| scheduled_actions | PagerDuty service incident escalation actions related within support hours. | object({ |
null |
no |
| service_graph | PagerDuty service graph components. | object({ |
{ |
no |
| slack_connection | PagerDuty service Slack connection configuration. | object({ |
null |
no |
| support_hours | PagerDuty service support hours. | object({ |
null |
no |
| team_id | PagerDuty business service owner team ID (Business/Enterprise plan). | string |
null |
no |
| Name | Description |
|---|---|
| cloudwatch_integration_key | PagerDuty service CloudWatch integration key. |
| datadog_integration_key | PagerDuty service DataDog integration key. |
| newrelic_integration_key | PagerDuty service NewRelic integration key. |
| pagerduty_service | PagerDuty service. |
This project uses conventional commits.
brew install pre-commit tfswitch terraform-docs tflint
pre-commit install --install-hooks
tflint --initConsider environment variables management for Terraform provider authentication via .env file, which mise
picks up automatically:
PAGERDUTY_SERVICE_REGION=eu
PAGERDUTY_TOKEN=<REDACTED>
PAGERDUTY_USER_TOKEN=$PAGERDUTY_TOKEN
export PAGERDUTY_SERVICE_REGION=eu
export PAGERDUTY_TOKEN=<REDACTED>
export PAGERDUTY_USER_TOKEN=$PAGERDUTY_TOKENcd examples/business-service
terraform init
terraform apply
terraform destroycd examples/technical-service
terraform init
terraform apply
terraform destroyThe terraform test command looks for *.tftest.hcl files in both root directory and tests directory.
terraform init
terraform test
terraform test -filter tests/main.tftest.hcl -verbose