terraform-provider-pagerduty
terraform-provider-pagerduty copied to clipboard
Add-one extension service with Slack2 to specific channel configuration.
Hi there,
Terraform Version
Terraform v0.15.3
Affected Resource(s)
Please list the resources as a list, for example:
i wanna to implement extension add-on to specific service. The extension add-on is Slack V2 and associate specific channel. I not very sure my configuration have any miss?
Terraform Configuration Files
resource "pagerduty_extension" "slack"{
name = "#alert" # channel name
endpoint_url = "https://hooks.slack.com/services/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" # this is slack channel link
/* extension_schema = data.pagerduty_extension_schema.webhook.id */ # i don't know this argument that i need fill out what information.
extension_objects = [pagerduty_service.promethues.id]
}
Panic Output
$ terraform plan [12:13:53]
Acquiring state lock. This may take a few moments...
Releasing state lock. This may take a few moments...
╷
│ Warning: Version constraints inside provider configuration blocks are deprecated
│
│ on backend.tf line 12, in provider "azurerm":
│ 12: version = "~>2.0"
│
│ Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed in a future version of Terraform. To silence this warning, move the
│ provider version constraint into the required_providers block.
╵
╷
│ Error: Missing required argument
│
│ on extentionsvc.tf line 1, in resource "pagerduty_extension" "slack":
│ 1: resource "pagerduty_extension" "slack"{
│
│ The argument "extension_schema" is required, but no definition was found.
╵
FAIL: 1
@JayChanggithub In case you want to send notifications from specific PD service into some Slack channels, brand new slack_connection resources might do the trick.
I've used this method and it does the job nicely, but have few drawbacks:
- you'll need to create some service account on PD side and pass his API key to PD provider config as
user_token - you'll need to link that PD service account with actual Slack user account (PD will perform requests to Slack API on behalf on that user)
- in case you want to send notifications into private channels that Slack user must be in that private channel (otherwise, notifications will not appear on Slack side)
In case you need extension add-on specifically, here is the code example which might work according to docs:
data "pagerduty_extension_schema" "slack_v2" {
name = "Slack V2"
}
resource "pagerduty_extension" "slack"{
name = "channel name"
endpoint_url = "slack hook url"
extension_schema = data.pagerduty_extension_schema.slack_v2.id
extension_objects = [pagerduty_service.promethues.id]
}
However, multiple issues in that repo states that those Slack V2 extensions wouldn't work anymore due to changes on Slack API side and PD folks recommend using slack_connection instead (example).