PagerDuty / terraform-provider-pagerduty

Terraform PagerDuty provider
https://www.terraform.io/docs/providers/pagerduty/
Mozilla Public License 2.0
206 stars 210 forks source link

Feature request: Expose config argument in pagerduty_service_integration #806

Closed palloberg closed 8 months ago

palloberg commented 8 months ago

When creating a service integration it is only possible to arguments to configure email routing. However, when inspecting the REST API there appears to be a config block in the JSON containing vendor specific parameters.

Being able to set and modify this config block via the Terraform provider would allow us to better manage integrations like GitHub/GitLab (set target branch), CloudWatch (set source for alert title), AWS Guard Duty (set event correlation), etc.

From the API it seems like mapping the fields dictionary inside config should cover most cases.

This would probably also solve #729

Possible HCL for this:

resource "pagerduty_service_integration" "cloudwatch" {
  name    = "CloudWatch alarm"
  vendor  = data.pagerduty_vendor.cloudwatch.id
  service = pagerduty_service.foo.id
  config {
    incident_key = "alarm_name"
    description  = "alarm_description"
  }
}

resource "pagerduty_service_integration" "github" {
  name    = "GitHub integration"
  vendor  = data.pagerduty_vendor.github.id
  service = pagerduty_service.bar.id
  config {
    branch = "main release"
  }
}
imjaroiswebdev commented 8 months ago

Hi @palloberg I get what your saying about the capability differences between /services/{id}/integrations used by PagerDuty's WebUI and the REST API one, unfortunately, exposing this vendor configuration capabilities for Service Integrations public REST API is not currently part of our roadmap.