A slack connection allows you to connect a workspace in Slack to a PagerDuty service or team which allows you to acknowledge and resolve PagerDuty incidents from the Slack user interface.
NOTES for using this resource:
user_token
on the provider tag or as the PAGERDUTY_USER_TOKEN
environment variable.resource "pagerduty_team" "foo" {
name = "Team Foo"
}
data "pagerduty_priority" "p1" {
name = "P1"
}
resource "pagerduty_slack_connection" "foo" {
source_id = pagerduty_team.foo.id
source_type = "team_reference"
workspace_id = "T02A123LV1A"
channel_id = "C02CABCDAC9"
notification_type = "responder"
config {
events = [
"incident.triggered",
"incident.acknowledged",
"incident.escalated",
"incident.resolved",
"incident.reassigned",
"incident.annotated",
"incident.unacknowledged",
"incident.delegated",
"incident.priority_updated",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.reopened"
]
priorities = [data.pagerduty_priority.p1.id]
}
}
The following arguments are supported:
source_id
- (Required) The ID of the source in PagerDuty. Valid sources are services or teams.source_type
- (Required) The type of the source. Either team_reference
or service_reference
.workspace_id
- (Required) The slack team (workspace) ID of the connected Slack workspace. Can also be defined by the SLACK_CONNECTION_WORKSPACE_ID
environment variable.channel_id
- (Required) The ID of a Slack channel in the workspace.config
- (Required) Configuration options for the Slack connection that provide options to filter events.notification_type
- (Required) Type of notification. Either responder
or stakeholder
.config
) Supports the following:events
- (Required) A list of strings to filter events by PagerDuty event type. "incident.triggered"
is required. The follow event types are also possible:
incident.acknowledged
incident.escalated
incident.resolved
incident.reassigned
incident.annotated
incident.unacknowledged
incident.delegated
incident.priority_updated
incident.responder.added
incident.responder.replied
incident.status_update_published
incident.reopened
priorities
- (Optional) Allows you to filter events by priority. Needs to be an array of PagerDuty priority IDs. Available through pagerduty_priority data source.
[]
) in the configuration for a Slack Connection, its default behaviour is to set priorities
to No Priority
value.["*"]
its corresponding value for priorities
in Slack Connection's configuration will be Any Priority
.urgency
- (Optional) Allows you to filter events by urgency. Either high
or low
.The following attributes are exported:
id
- The ID of the slack connection.source_name
- Name of the source (team or service) in Slack connection.channel_name
- Name of the Slack channel in Slack connection.Slack connections can be imported using the related workspace
ID and the slack_connection
ID separated by a dot, e.g.
$ terraform import pagerduty_slack_connection.main T02A123LV1A.PUABCDL