PagerDuty / terraform-provider-pagerduty

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

pagerduty_vendor for "Events API v2" #932

Closed pedrocarrico closed 1 month ago

pedrocarrico commented 2 months ago

Hi,

I'm trying to get the details of a PagerDuty vendor to create a service integration but when I fetch with the name "Events API v2" I get the details for "PRTG Notification For PagerDuty Events API v2". The "Events API v2" integration is done by PageDuty not an external vendor so probably that integration isn't possible to be fetched from this API? How can I fetch via terraform the details for this integration type so I can create a service integration correctly?

Terraform Version

v1.8.5

Affected Resource(s)

pagerduty_vendor on version 3.15.6

Terraform Configuration Files

data "pagerduty_vendor" "events_api_v2" {
  name = "Events API v2"
}

resource "pagerduty_service_integration" "example" {
  name    = data.pagerduty_vendor.events_api_v2.name
  service = pagerduty_service.example.id
  vendor  = data.pagerduty_vendor.events_api_v2.id
}

Expected Behavior

On that data resource I should get the "Events API v2" vendor and integration details.

Actual Behavior

I got the "PRTG Notification For PagerDuty Events API v2" vendor and integration details.

Steps to Reproduce

Use the data resource, see that if fetches the wrong vendor for the integration.

Important Factoids

References

cavila-evoliq commented 1 month ago

I don't think you can set that integration that way. They have some examples on how to fetch this in their docs here.

resource "pagerduty_service_integration" "apiv2" {
  name            = "API V2"
  type            = "events_api_v2_inbound_integration"
  service         = pagerduty_service.example.id
}

The above should create a pagerduty service which you should be able to output with something like:

output "integration_key" {
  description = "The integration key for the PagerDuty service."
  value       = sensitive(pagerduty_service_integration.apiv2.integration_key)
  sensitive   = true
}
pedrocarrico commented 1 month ago

Thanks @cavila-evoliq! Yeah that seems to work well!