terraform-provider-pagerduty: unable to use terraform-provider-pagerduty to create a Slack extension
$ terraform -v Terraform v0.10.8
aws_provider_version = “1.9” pagerduty_provider_version = “1.0”
Using the brand new pagerduty provider extension (thanks much for that!) https://github.com/terraform-providers/terraform-provider-pagerduty/pull/69
data "pagerduty_extension_schema" "webhook" {
name = "Slack"
}
resource "pagerduty_extension" "slack" {
name = "name"
endpoint_url = "https://hooks.slack.com/services/redacted"
extension_schema = "${data.pagerduty_extension_schema.webhook.id}"
extension_objects = ["${pagerduty_service.service.id}"]
}
If I use the “Slack” pagerduty_extension_schema, Terraform creates a new extension. However the extension doesn’t work (send messages to the appropriate slack channel) unless I authorize it in the Pagerduty console , and the icon in Pagerduty under Configuration / Extensions is broken (circle w/ a slash through it). If I then edit the new extension in Pagerduty, select the Slack channel, and authorize the extension, it will then work.
Questions -
- how do I fully automate creating an extension? I don’t see a way to authorize the extension and tell Pagerduty which slack channel to use for the notification using new extension
- is there a way to use “Generic V2 Webhook” as a Slack extension? I’m just looking for a way to make this work easily, I don’t need to use Generic V2 Webhook if the Slack extension will work.
“Generic V2 Webhook” pagerduty_extension_schema will create a new extension, but the extension won’t work.
Also, I notice that we have older Slack extensions in Pagerduty with a “Slack (legacy webhook)” type “Slack (Legacy Webhook)” pagerduty_extension_schema errors out with the following: “data.pagerduty_extension_schema.webhook: Unable to locate any extension schema with the name: Slack (Legacy Webhook)”
thanks, Dusty
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 21
- Comments: 15 (5 by maintainers)
What’s the update on this issue?
For future readers, this problem still exists because Slack has revoked the ability to create Legacy access tokens. We’re still waiting on a better solution from the PagerDuty Team.
Got a reply. As workaround it is possible to use existing oauth authorization using custom json in the
configobject. It is discussed in the https://community.pagerduty.com/t/how-to-pass-config-data-when-creating-an-extension/1857.For me it looks like a good option, at least i see this token using API call:
@cdhunt is there any chance to get https://github.com/terraform-providers/terraform-provider-pagerduty/pull/84 accepted? Looks like it could be a good workaround for that issue.
Alas, the
access_tokenno longer appears in theconfigsection, which now looks more like this:I haven’t been able to find a way to “borrow” an existing extension to create a new one.
The API docs says: