pagerduty.WebhookSubscription
Explore with Pulumi AI
A webhook subscription allow you to receive HTTP callbacks when incidents are created, updated and deleted. These are also known as V3 Webhooks.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";
const example = pagerduty.getService({
name: "My Service",
});
const foo = new pagerduty.WebhookSubscription("foo", {
deliveryMethods: [{
type: "http_delivery_method",
url: "https://example.com/receive_a_pagerduty_webhook",
customHeaders: [
{
name: "X-Foo",
value: "foo",
},
{
name: "X-Bar",
value: "bar",
},
],
}],
description: "%s",
events: [
"incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.triggered",
"incident.unacknowledged",
],
active: true,
filters: [{
id: example.then(example => example.id),
type: "service_reference",
}],
type: "webhook_subscription",
});
import pulumi
import pulumi_pagerduty as pagerduty
example = pagerduty.get_service(name="My Service")
foo = pagerduty.WebhookSubscription("foo",
delivery_methods=[pagerduty.WebhookSubscriptionDeliveryMethodArgs(
type="http_delivery_method",
url="https://example.com/receive_a_pagerduty_webhook",
custom_headers=[
pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs(
name="X-Foo",
value="foo",
),
pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs(
name="X-Bar",
value="bar",
),
],
)],
description="%s",
events=[
"incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.triggered",
"incident.unacknowledged",
],
active=True,
filters=[pagerduty.WebhookSubscriptionFilterArgs(
id=example.id,
type="service_reference",
)],
type="webhook_subscription")
package main
import (
"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pagerduty.LookupService(ctx, &pagerduty.LookupServiceArgs{
Name: "My Service",
}, nil)
if err != nil {
return err
}
_, err = pagerduty.NewWebhookSubscription(ctx, "foo", &pagerduty.WebhookSubscriptionArgs{
DeliveryMethods: pagerduty.WebhookSubscriptionDeliveryMethodArray{
&pagerduty.WebhookSubscriptionDeliveryMethodArgs{
Type: pulumi.String("http_delivery_method"),
Url: pulumi.String("https://example.com/receive_a_pagerduty_webhook"),
CustomHeaders: pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArray{
&pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs{
Name: pulumi.String("X-Foo"),
Value: pulumi.String("foo"),
},
&pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs{
Name: pulumi.String("X-Bar"),
Value: pulumi.String("bar"),
},
},
},
},
Description: pulumi.String("%s"),
Events: pulumi.StringArray{
pulumi.String("incident.acknowledged"),
pulumi.String("incident.annotated"),
pulumi.String("incident.delegated"),
pulumi.String("incident.escalated"),
pulumi.String("incident.priority_updated"),
pulumi.String("incident.reassigned"),
pulumi.String("incident.reopened"),
pulumi.String("incident.resolved"),
pulumi.String("incident.responder.added"),
pulumi.String("incident.responder.replied"),
pulumi.String("incident.status_update_published"),
pulumi.String("incident.triggered"),
pulumi.String("incident.unacknowledged"),
},
Active: pulumi.Bool(true),
Filters: pagerduty.WebhookSubscriptionFilterArray{
&pagerduty.WebhookSubscriptionFilterArgs{
Id: pulumi.String(example.Id),
Type: pulumi.String("service_reference"),
},
},
Type: pulumi.String("webhook_subscription"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Pagerduty = Pulumi.Pagerduty;
return await Deployment.RunAsync(() =>
{
var example = Pagerduty.GetService.Invoke(new()
{
Name = "My Service",
});
var foo = new Pagerduty.WebhookSubscription("foo", new()
{
DeliveryMethods = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionDeliveryMethodArgs
{
Type = "http_delivery_method",
Url = "https://example.com/receive_a_pagerduty_webhook",
CustomHeaders = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionDeliveryMethodCustomHeaderArgs
{
Name = "X-Foo",
Value = "foo",
},
new Pagerduty.Inputs.WebhookSubscriptionDeliveryMethodCustomHeaderArgs
{
Name = "X-Bar",
Value = "bar",
},
},
},
},
Description = "%s",
Events = new[]
{
"incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.triggered",
"incident.unacknowledged",
},
Active = true,
Filters = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionFilterArgs
{
Id = example.Apply(getServiceResult => getServiceResult.Id),
Type = "service_reference",
},
},
Type = "webhook_subscription",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pagerduty.PagerdutyFunctions;
import com.pulumi.pagerduty.inputs.GetServiceArgs;
import com.pulumi.pagerduty.WebhookSubscription;
import com.pulumi.pagerduty.WebhookSubscriptionArgs;
import com.pulumi.pagerduty.inputs.WebhookSubscriptionDeliveryMethodArgs;
import com.pulumi.pagerduty.inputs.WebhookSubscriptionFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = PagerdutyFunctions.getService(GetServiceArgs.builder()
.name("My Service")
.build());
var foo = new WebhookSubscription("foo", WebhookSubscriptionArgs.builder()
.deliveryMethods(WebhookSubscriptionDeliveryMethodArgs.builder()
.type("http_delivery_method")
.url("https://example.com/receive_a_pagerduty_webhook")
.customHeaders(
WebhookSubscriptionDeliveryMethodCustomHeaderArgs.builder()
.name("X-Foo")
.value("foo")
.build(),
WebhookSubscriptionDeliveryMethodCustomHeaderArgs.builder()
.name("X-Bar")
.value("bar")
.build())
.build())
.description("%s")
.events(
"incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.triggered",
"incident.unacknowledged")
.active(true)
.filters(WebhookSubscriptionFilterArgs.builder()
.id(example.applyValue(getServiceResult -> getServiceResult.id()))
.type("service_reference")
.build())
.type("webhook_subscription")
.build());
}
}
resources:
foo:
type: pagerduty:WebhookSubscription
properties:
deliveryMethods:
- type: http_delivery_method
url: https://example.com/receive_a_pagerduty_webhook
customHeaders:
- name: X-Foo
value: foo
- name: X-Bar
value: bar
description: '%s'
events:
- incident.acknowledged
- incident.annotated
- incident.delegated
- incident.escalated
- incident.priority_updated
- incident.reassigned
- incident.reopened
- incident.resolved
- incident.responder.added
- incident.responder.replied
- incident.status_update_published
- incident.triggered
- incident.unacknowledged
active: true
filters:
- id: ${example.id}
type: service_reference
type: webhook_subscription
variables:
example:
fn::invoke:
Function: pagerduty:getService
Arguments:
name: My Service
Create WebhookSubscription Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WebhookSubscription(name: string, args: WebhookSubscriptionArgs, opts?: CustomResourceOptions);
@overload
def WebhookSubscription(resource_name: str,
args: WebhookSubscriptionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def WebhookSubscription(resource_name: str,
opts: Optional[ResourceOptions] = None,
delivery_methods: Optional[Sequence[WebhookSubscriptionDeliveryMethodArgs]] = None,
events: Optional[Sequence[str]] = None,
filters: Optional[Sequence[WebhookSubscriptionFilterArgs]] = None,
active: Optional[bool] = None,
description: Optional[str] = None,
type: Optional[str] = None)
func NewWebhookSubscription(ctx *Context, name string, args WebhookSubscriptionArgs, opts ...ResourceOption) (*WebhookSubscription, error)
public WebhookSubscription(string name, WebhookSubscriptionArgs args, CustomResourceOptions? opts = null)
public WebhookSubscription(String name, WebhookSubscriptionArgs args)
public WebhookSubscription(String name, WebhookSubscriptionArgs args, CustomResourceOptions options)
type: pagerduty:WebhookSubscription
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args WebhookSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args WebhookSubscriptionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args WebhookSubscriptionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WebhookSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WebhookSubscriptionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Example
The following reference example uses placeholder values for all input properties.
var webhookSubscriptionResource = new Pagerduty.WebhookSubscription("webhookSubscriptionResource", new()
{
DeliveryMethods = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionDeliveryMethodArgs
{
CustomHeaders = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionDeliveryMethodCustomHeaderArgs
{
Name = "string",
Value = "string",
},
},
TemporarilyDisabled = false,
Type = "string",
Url = "string",
},
},
Events = new[]
{
"string",
},
Filters = new[]
{
new Pagerduty.Inputs.WebhookSubscriptionFilterArgs
{
Type = "string",
Id = "string",
},
},
Active = false,
Description = "string",
Type = "string",
});
example, err := pagerduty.NewWebhookSubscription(ctx, "webhookSubscriptionResource", &pagerduty.WebhookSubscriptionArgs{
DeliveryMethods: pagerduty.WebhookSubscriptionDeliveryMethodArray{
&pagerduty.WebhookSubscriptionDeliveryMethodArgs{
CustomHeaders: pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArray{
&pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
TemporarilyDisabled: pulumi.Bool(false),
Type: pulumi.String("string"),
Url: pulumi.String("string"),
},
},
Events: pulumi.StringArray{
pulumi.String("string"),
},
Filters: pagerduty.WebhookSubscriptionFilterArray{
&pagerduty.WebhookSubscriptionFilterArgs{
Type: pulumi.String("string"),
Id: pulumi.String("string"),
},
},
Active: pulumi.Bool(false),
Description: pulumi.String("string"),
Type: pulumi.String("string"),
})
var webhookSubscriptionResource = new WebhookSubscription("webhookSubscriptionResource", WebhookSubscriptionArgs.builder()
.deliveryMethods(WebhookSubscriptionDeliveryMethodArgs.builder()
.customHeaders(WebhookSubscriptionDeliveryMethodCustomHeaderArgs.builder()
.name("string")
.value("string")
.build())
.temporarilyDisabled(false)
.type("string")
.url("string")
.build())
.events("string")
.filters(WebhookSubscriptionFilterArgs.builder()
.type("string")
.id("string")
.build())
.active(false)
.description("string")
.type("string")
.build());
webhook_subscription_resource = pagerduty.WebhookSubscription("webhookSubscriptionResource",
delivery_methods=[pagerduty.WebhookSubscriptionDeliveryMethodArgs(
custom_headers=[pagerduty.WebhookSubscriptionDeliveryMethodCustomHeaderArgs(
name="string",
value="string",
)],
temporarily_disabled=False,
type="string",
url="string",
)],
events=["string"],
filters=[pagerduty.WebhookSubscriptionFilterArgs(
type="string",
id="string",
)],
active=False,
description="string",
type="string")
const webhookSubscriptionResource = new pagerduty.WebhookSubscription("webhookSubscriptionResource", {
deliveryMethods: [{
customHeaders: [{
name: "string",
value: "string",
}],
temporarilyDisabled: false,
type: "string",
url: "string",
}],
events: ["string"],
filters: [{
type: "string",
id: "string",
}],
active: false,
description: "string",
type: "string",
});
type: pagerduty:WebhookSubscription
properties:
active: false
deliveryMethods:
- customHeaders:
- name: string
value: string
temporarilyDisabled: false
type: string
url: string
description: string
events:
- string
filters:
- id: string
type: string
type: string
WebhookSubscription Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The WebhookSubscription resource accepts the following input properties:
- Delivery
Methods List<WebhookSubscription Delivery Method> - Events List<string>
- Filters
List<Webhook
Subscription Filter> - Active bool
- Description string
- Type string
- Delivery
Methods []WebhookSubscription Delivery Method Args - Events []string
- Filters
[]Webhook
Subscription Filter Args - Active bool
- Description string
- Type string
- delivery
Methods List<WebhookSubscription Delivery Method> - events List<String>
- filters
List<Webhook
Subscription Filter> - active Boolean
- description String
- type String
- delivery
Methods WebhookSubscription Delivery Method[] - events string[]
- filters
Webhook
Subscription Filter[] - active boolean
- description string
- type string
- delivery
Methods List<Property Map> - events List<String>
- filters List<Property Map>
- active Boolean
- description String
- type String
Outputs
All input properties are implicitly available as output properties. Additionally, the WebhookSubscription resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing WebhookSubscription Resource
Get an existing WebhookSubscription resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: WebhookSubscriptionState, opts?: CustomResourceOptions): WebhookSubscription
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
active: Optional[bool] = None,
delivery_methods: Optional[Sequence[WebhookSubscriptionDeliveryMethodArgs]] = None,
description: Optional[str] = None,
events: Optional[Sequence[str]] = None,
filters: Optional[Sequence[WebhookSubscriptionFilterArgs]] = None,
type: Optional[str] = None) -> WebhookSubscription
func GetWebhookSubscription(ctx *Context, name string, id IDInput, state *WebhookSubscriptionState, opts ...ResourceOption) (*WebhookSubscription, error)
public static WebhookSubscription Get(string name, Input<string> id, WebhookSubscriptionState? state, CustomResourceOptions? opts = null)
public static WebhookSubscription get(String name, Output<String> id, WebhookSubscriptionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Active bool
- Delivery
Methods List<WebhookSubscription Delivery Method> - Description string
- Events List<string>
- Filters
List<Webhook
Subscription Filter> - Type string
- Active bool
- Delivery
Methods []WebhookSubscription Delivery Method Args - Description string
- Events []string
- Filters
[]Webhook
Subscription Filter Args - Type string
- active Boolean
- delivery
Methods List<WebhookSubscription Delivery Method> - description String
- events List<String>
- filters
List<Webhook
Subscription Filter> - type String
- active boolean
- delivery
Methods WebhookSubscription Delivery Method[] - description string
- events string[]
- filters
Webhook
Subscription Filter[] - type string
- active Boolean
- delivery
Methods List<Property Map> - description String
- events List<String>
- filters List<Property Map>
- type String
Supporting Types
WebhookSubscriptionDeliveryMethod, WebhookSubscriptionDeliveryMethodArgs
- Custom
Headers List<WebhookSubscription Delivery Method Custom Header> - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- Temporarily
Disabled bool - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- Type string
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - Url string
- The destination URL for webhook delivery.
- Custom
Headers []WebhookSubscription Delivery Method Custom Header - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- Temporarily
Disabled bool - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- Type string
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - Url string
- The destination URL for webhook delivery.
- custom
Headers List<WebhookSubscription Delivery Method Custom Header> - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- temporarily
Disabled Boolean - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- type String
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - url String
- The destination URL for webhook delivery.
- custom
Headers WebhookSubscription Delivery Method Custom Header[] - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- temporarily
Disabled boolean - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- type string
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - url string
- The destination URL for webhook delivery.
- custom_
headers Sequence[WebhookSubscription Delivery Method Custom Header] - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- temporarily_
disabled bool - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- type str
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - url str
- The destination URL for webhook delivery.
- custom
Headers List<Property Map> - The custom_header of a webhook subscription define any optional headers that will be passed along with the payload to the destination URL.
- temporarily
Disabled Boolean - Whether this webhook subscription is temporarily disabled. Becomes true if the delivery method URL is repeatedly rejected by the server.
- type String
- Indicates the type of the delivery method. Allowed and default value:
http_delivery_method
. - url String
- The destination URL for webhook delivery.
WebhookSubscriptionDeliveryMethodCustomHeader, WebhookSubscriptionDeliveryMethodCustomHeaderArgs
WebhookSubscriptionFilter, WebhookSubscriptionFilterArgs
Import
Webhook Subscriptions can be imported using the id
, e.g.
$ pulumi import pagerduty:index/webhookSubscription:WebhookSubscription main PUABCDL
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- PagerDuty pulumi/pulumi-pagerduty
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
pagerduty
Terraform Provider.