terraform-provider-pagerduty
terraform-provider-pagerduty copied to clipboard
Need the ability to set javascript code to execute for event_transformer_api_inbound_integration
Team,
I am having much success using this terraform module. Thank you for putting this all together.
I am building a Cisco Meraki integration with PD. For this I create a pagerduty_service_integration
resource "pagerduty_service_integration" "meraki-event-transformer" {
for_each = local.locations
name = "meraki-${each.key}"
service = pagerduty_service.meraki[each.key].id
vendor = data.pagerduty_vendor.custom-event.id
}
This in turn creates a integration of type: event_transformer_api_inbound_integration
I need to be able to set the javascript code which transforms this event so its usable.
Is this already possible with the terraform provider ? If not please consider this a feature request while I set manually all 100+ service integrations I will have :)
Thank you, -Guy
Hi, I believe this would require exposing the config
field of the service integration which was declined in https://github.com/PagerDuty/go-pagerduty/issues/67
E.g.:
GET https://api.pagerduty.com/services/PNTFJEB/integrations/P245KD8
{
"integration": {
"id": "P245KD8",
"type": "event_transformer_api_inbound_integration",
"summary": "Custom Event Transformer",
"self": "https://api.pagerduty.com/services/PNTFJEB/integrations/P245KD8",
"html_url": "https://dev-mydomain.pagerduty.com/services/PNTFJEB/integrations/P245KD8",
"name": "Custom Event Transformer",
"service": {
"id": "PNTFJEB",
"type": "service_reference",
"summary": "Test event transformer",
"self": "https://api.pagerduty.com/services/PNTFJEB",
"html_url": "https://dev-mydomain.pagerduty.com/service-directory/PNTFJEB"
},
"created_at": "2022-07-08T12:39:25+02:00",
"vendor": {
"id": "PCJ0EFQ",
"type": "vendor_reference",
"summary": "Custom Event Transformer",
"self": "https://api.pagerduty.com/vendors/PCJ0EFQ",
"html_url": null
},
"integration_key": "27078fb95d154204d00ad3d67436f60b",
"config": {
"fields": {
"code": {
"type": "code",
"required": false,
"label": "The code you want to execute.",
"value": "var normalized_event = {\n event_type: PD.Trigger,\n description: \"Custom Event Transform\",\n details: PD.inputRequest\n};\n\nPD.emitGenericEvents([normalized_event]);",
"ui_order": 0
},
"debug": {
"type": "select",
"required": false,
"label": "Debug mode (send an event to your service if code produces errors)",
"valid_values": {
"debug_on": {
"label": "Enabled",
"ui_order": 1
},
"debug_off": {
"label": "Disabled",
"ui_order": 2
}
},
"value": "debug_on",
"ui_order": 1
}
}
}
}
}
Related: https://github.com/PagerDuty/terraform-provider-pagerduty/issues/173#issuecomment-568575441
Hi, I believe this would require exposing the
config
field of the service integration which was declined in PagerDuty/go-pagerduty#67
Correct. I need to set the config field with type=code
and value=my transformation code
.
This appears to be solid in UI for this integration type. Please re-consider adding this to the resource.
Could one of the code owners lets us know what the current status of the config API is ? It was mentioned in https://github.com/PagerDuty/go-pagerduty/issues/67 that it was in flux hence why it was not included, however that was 6 years ago, surely it should have stabilized by now
Hey folks! Sorry for providing you this update, because it might sound discouraging, however at this moment the preferred way to setup Custom Event Transformers is through use of Apps Event Transformers, because We don't have plans on short to mid term on exposing the config
field on this API to be used on the resource pagerduty_service_integration
.