pagerduty.SlackConnection
Explore with Pulumi AI
A slack connection allows you to connect a workspace in Slack to a PagerDuty service or team which allows you to acknowledge and resolve PagerDuty incidents from the Slack user interface.
NOTES for using this resource:
- To first use this resource you will need to map your PagerDuty account to a valid Slack Workspace. This can only be done through the PagerDuty UI.
- This resource requires a PagerDuty user-level API key. This can be set as the
user_token
on the provider tag or as thePAGERDUTY_USER_TOKEN
environment variable. - This resource is for configuring Slack V2 Next Generation connections. If you configured your Slack integration (V1 or V2) prior to August 10, 2021, you may migrate to the Slack V2 Next Generation update using this migration instructions, but if you configured your Slack integration after that date, you will have access to the update out of the box.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";
const foo = new pagerduty.Team("foo", {name: "Team Foo"});
const p1 = pagerduty.getPriority({
name: "P1",
});
const fooSlackConnection = new pagerduty.SlackConnection("foo", {
sourceId: foo.id,
sourceType: "team_reference",
workspaceId: "T02A123LV1A",
channelId: "C02CABCDAC9",
notificationType: "responder",
configs: [{
events: [
"incident.triggered",
"incident.acknowledged",
"incident.escalated",
"incident.resolved",
"incident.reassigned",
"incident.annotated",
"incident.unacknowledged",
"incident.delegated",
"incident.priority_updated",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.reopened",
],
priorities: [p1.then(p1 => p1.id)],
}],
});
import pulumi
import pulumi_pagerduty as pagerduty
foo = pagerduty.Team("foo", name="Team Foo")
p1 = pagerduty.get_priority(name="P1")
foo_slack_connection = pagerduty.SlackConnection("foo",
source_id=foo.id,
source_type="team_reference",
workspace_id="T02A123LV1A",
channel_id="C02CABCDAC9",
notification_type="responder",
configs=[pagerduty.SlackConnectionConfigArgs(
events=[
"incident.triggered",
"incident.acknowledged",
"incident.escalated",
"incident.resolved",
"incident.reassigned",
"incident.annotated",
"incident.unacknowledged",
"incident.delegated",
"incident.priority_updated",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.reopened",
],
priorities=[p1.id],
)])
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 {
foo, err := pagerduty.NewTeam(ctx, "foo", &pagerduty.TeamArgs{
Name: pulumi.String("Team Foo"),
})
if err != nil {
return err
}
p1, err := pagerduty.GetPriority(ctx, &pagerduty.GetPriorityArgs{
Name: "P1",
}, nil)
if err != nil {
return err
}
_, err = pagerduty.NewSlackConnection(ctx, "foo", &pagerduty.SlackConnectionArgs{
SourceId: foo.ID(),
SourceType: pulumi.String("team_reference"),
WorkspaceId: pulumi.String("T02A123LV1A"),
ChannelId: pulumi.String("C02CABCDAC9"),
NotificationType: pulumi.String("responder"),
Configs: pagerduty.SlackConnectionConfigArray{
&pagerduty.SlackConnectionConfigArgs{
Events: pulumi.StringArray{
pulumi.String("incident.triggered"),
pulumi.String("incident.acknowledged"),
pulumi.String("incident.escalated"),
pulumi.String("incident.resolved"),
pulumi.String("incident.reassigned"),
pulumi.String("incident.annotated"),
pulumi.String("incident.unacknowledged"),
pulumi.String("incident.delegated"),
pulumi.String("incident.priority_updated"),
pulumi.String("incident.responder.added"),
pulumi.String("incident.responder.replied"),
pulumi.String("incident.status_update_published"),
pulumi.String("incident.reopened"),
},
Priorities: pulumi.StringArray{
pulumi.String(p1.Id),
},
},
},
})
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 foo = new Pagerduty.Team("foo", new()
{
Name = "Team Foo",
});
var p1 = Pagerduty.GetPriority.Invoke(new()
{
Name = "P1",
});
var fooSlackConnection = new Pagerduty.SlackConnection("foo", new()
{
SourceId = foo.Id,
SourceType = "team_reference",
WorkspaceId = "T02A123LV1A",
ChannelId = "C02CABCDAC9",
NotificationType = "responder",
Configs = new[]
{
new Pagerduty.Inputs.SlackConnectionConfigArgs
{
Events = new[]
{
"incident.triggered",
"incident.acknowledged",
"incident.escalated",
"incident.resolved",
"incident.reassigned",
"incident.annotated",
"incident.unacknowledged",
"incident.delegated",
"incident.priority_updated",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.reopened",
},
Priorities = new[]
{
p1.Apply(getPriorityResult => getPriorityResult.Id),
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pagerduty.Team;
import com.pulumi.pagerduty.TeamArgs;
import com.pulumi.pagerduty.PagerdutyFunctions;
import com.pulumi.pagerduty.inputs.GetPriorityArgs;
import com.pulumi.pagerduty.SlackConnection;
import com.pulumi.pagerduty.SlackConnectionArgs;
import com.pulumi.pagerduty.inputs.SlackConnectionConfigArgs;
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) {
var foo = new Team("foo", TeamArgs.builder()
.name("Team Foo")
.build());
final var p1 = PagerdutyFunctions.getPriority(GetPriorityArgs.builder()
.name("P1")
.build());
var fooSlackConnection = new SlackConnection("fooSlackConnection", SlackConnectionArgs.builder()
.sourceId(foo.id())
.sourceType("team_reference")
.workspaceId("T02A123LV1A")
.channelId("C02CABCDAC9")
.notificationType("responder")
.configs(SlackConnectionConfigArgs.builder()
.events(
"incident.triggered",
"incident.acknowledged",
"incident.escalated",
"incident.resolved",
"incident.reassigned",
"incident.annotated",
"incident.unacknowledged",
"incident.delegated",
"incident.priority_updated",
"incident.responder.added",
"incident.responder.replied",
"incident.status_update_published",
"incident.reopened")
.priorities(p1.applyValue(getPriorityResult -> getPriorityResult.id()))
.build())
.build());
}
}
resources:
foo:
type: pagerduty:Team
properties:
name: Team Foo
fooSlackConnection:
type: pagerduty:SlackConnection
name: foo
properties:
sourceId: ${foo.id}
sourceType: team_reference
workspaceId: T02A123LV1A
channelId: C02CABCDAC9
notificationType: responder
configs:
- events:
- incident.triggered
- incident.acknowledged
- incident.escalated
- incident.resolved
- incident.reassigned
- incident.annotated
- incident.unacknowledged
- incident.delegated
- incident.priority_updated
- incident.responder.added
- incident.responder.replied
- incident.status_update_published
- incident.reopened
priorities:
- ${p1.id}
variables:
p1:
fn::invoke:
Function: pagerduty:getPriority
Arguments:
name: P1
Create SlackConnection Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SlackConnection(name: string, args: SlackConnectionArgs, opts?: CustomResourceOptions);
@overload
def SlackConnection(resource_name: str,
args: SlackConnectionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SlackConnection(resource_name: str,
opts: Optional[ResourceOptions] = None,
channel_id: Optional[str] = None,
configs: Optional[Sequence[SlackConnectionConfigArgs]] = None,
notification_type: Optional[str] = None,
source_id: Optional[str] = None,
source_type: Optional[str] = None,
workspace_id: Optional[str] = None)
func NewSlackConnection(ctx *Context, name string, args SlackConnectionArgs, opts ...ResourceOption) (*SlackConnection, error)
public SlackConnection(string name, SlackConnectionArgs args, CustomResourceOptions? opts = null)
public SlackConnection(String name, SlackConnectionArgs args)
public SlackConnection(String name, SlackConnectionArgs args, CustomResourceOptions options)
type: pagerduty:SlackConnection
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 SlackConnectionArgs
- 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 SlackConnectionArgs
- 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 SlackConnectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SlackConnectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SlackConnectionArgs
- 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 slackConnectionResource = new Pagerduty.SlackConnection("slackConnectionResource", new()
{
ChannelId = "string",
Configs = new[]
{
new Pagerduty.Inputs.SlackConnectionConfigArgs
{
Events = new[]
{
"string",
},
Priorities = new[]
{
"string",
},
Urgency = "string",
},
},
NotificationType = "string",
SourceId = "string",
SourceType = "string",
WorkspaceId = "string",
});
example, err := pagerduty.NewSlackConnection(ctx, "slackConnectionResource", &pagerduty.SlackConnectionArgs{
ChannelId: pulumi.String("string"),
Configs: pagerduty.SlackConnectionConfigArray{
&pagerduty.SlackConnectionConfigArgs{
Events: pulumi.StringArray{
pulumi.String("string"),
},
Priorities: pulumi.StringArray{
pulumi.String("string"),
},
Urgency: pulumi.String("string"),
},
},
NotificationType: pulumi.String("string"),
SourceId: pulumi.String("string"),
SourceType: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
var slackConnectionResource = new SlackConnection("slackConnectionResource", SlackConnectionArgs.builder()
.channelId("string")
.configs(SlackConnectionConfigArgs.builder()
.events("string")
.priorities("string")
.urgency("string")
.build())
.notificationType("string")
.sourceId("string")
.sourceType("string")
.workspaceId("string")
.build());
slack_connection_resource = pagerduty.SlackConnection("slackConnectionResource",
channel_id="string",
configs=[pagerduty.SlackConnectionConfigArgs(
events=["string"],
priorities=["string"],
urgency="string",
)],
notification_type="string",
source_id="string",
source_type="string",
workspace_id="string")
const slackConnectionResource = new pagerduty.SlackConnection("slackConnectionResource", {
channelId: "string",
configs: [{
events: ["string"],
priorities: ["string"],
urgency: "string",
}],
notificationType: "string",
sourceId: "string",
sourceType: "string",
workspaceId: "string",
});
type: pagerduty:SlackConnection
properties:
channelId: string
configs:
- events:
- string
priorities:
- string
urgency: string
notificationType: string
sourceId: string
sourceType: string
workspaceId: string
SlackConnection 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 SlackConnection resource accepts the following input properties:
- Channel
Id string - Configs
List<Slack
Connection Config> - Notification
Type string - Source
Id string - Source
Type string - Workspace
Id string
- Channel
Id string - Configs
[]Slack
Connection Config Args - Notification
Type string - Source
Id string - Source
Type string - Workspace
Id string
- channel
Id String - configs
List<Slack
Connection Config> - notification
Type String - source
Id String - source
Type String - workspace
Id String
- channel
Id string - configs
Slack
Connection Config[] - notification
Type string - source
Id string - source
Type string - workspace
Id string
- channel
Id String - configs List<Property Map>
- notification
Type String - source
Id String - source
Type String - workspace
Id String
Outputs
All input properties are implicitly available as output properties. Additionally, the SlackConnection resource produces the following output properties:
- Channel
Name string - Name of the Slack channel in Slack connection.
- Id string
- The provider-assigned unique ID for this managed resource.
- Source
Name string - Name of the source (team or service) in Slack connection.
- Channel
Name string - Name of the Slack channel in Slack connection.
- Id string
- The provider-assigned unique ID for this managed resource.
- Source
Name string - Name of the source (team or service) in Slack connection.
- channel
Name String - Name of the Slack channel in Slack connection.
- id String
- The provider-assigned unique ID for this managed resource.
- source
Name String - Name of the source (team or service) in Slack connection.
- channel
Name string - Name of the Slack channel in Slack connection.
- id string
- The provider-assigned unique ID for this managed resource.
- source
Name string - Name of the source (team or service) in Slack connection.
- channel_
name str - Name of the Slack channel in Slack connection.
- id str
- The provider-assigned unique ID for this managed resource.
- source_
name str - Name of the source (team or service) in Slack connection.
- channel
Name String - Name of the Slack channel in Slack connection.
- id String
- The provider-assigned unique ID for this managed resource.
- source
Name String - Name of the source (team or service) in Slack connection.
Look up Existing SlackConnection Resource
Get an existing SlackConnection 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?: SlackConnectionState, opts?: CustomResourceOptions): SlackConnection
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
channel_id: Optional[str] = None,
channel_name: Optional[str] = None,
configs: Optional[Sequence[SlackConnectionConfigArgs]] = None,
notification_type: Optional[str] = None,
source_id: Optional[str] = None,
source_name: Optional[str] = None,
source_type: Optional[str] = None,
workspace_id: Optional[str] = None) -> SlackConnection
func GetSlackConnection(ctx *Context, name string, id IDInput, state *SlackConnectionState, opts ...ResourceOption) (*SlackConnection, error)
public static SlackConnection Get(string name, Input<string> id, SlackConnectionState? state, CustomResourceOptions? opts = null)
public static SlackConnection get(String name, Output<String> id, SlackConnectionState 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.
- Channel
Id string - Channel
Name string - Name of the Slack channel in Slack connection.
- Configs
List<Slack
Connection Config> - Notification
Type string - Source
Id string - Source
Name string - Name of the source (team or service) in Slack connection.
- Source
Type string - Workspace
Id string
- Channel
Id string - Channel
Name string - Name of the Slack channel in Slack connection.
- Configs
[]Slack
Connection Config Args - Notification
Type string - Source
Id string - Source
Name string - Name of the source (team or service) in Slack connection.
- Source
Type string - Workspace
Id string
- channel
Id String - channel
Name String - Name of the Slack channel in Slack connection.
- configs
List<Slack
Connection Config> - notification
Type String - source
Id String - source
Name String - Name of the source (team or service) in Slack connection.
- source
Type String - workspace
Id String
- channel
Id string - channel
Name string - Name of the Slack channel in Slack connection.
- configs
Slack
Connection Config[] - notification
Type string - source
Id string - source
Name string - Name of the source (team or service) in Slack connection.
- source
Type string - workspace
Id string
- channel_
id str - channel_
name str - Name of the Slack channel in Slack connection.
- configs
Sequence[Slack
Connection Config Args] - notification_
type str - source_
id str - source_
name str - Name of the source (team or service) in Slack connection.
- source_
type str - workspace_
id str
- channel
Id String - channel
Name String - Name of the Slack channel in Slack connection.
- configs List<Property Map>
- notification
Type String - source
Id String - source
Name String - Name of the source (team or service) in Slack connection.
- source
Type String - workspace
Id String
Supporting Types
SlackConnectionConfig, SlackConnectionConfigArgs
- Events List<string>
- Priorities List<string>
- Urgency string
- Events []string
- Priorities []string
- Urgency string
- events List<String>
- priorities List<String>
- urgency String
- events string[]
- priorities string[]
- urgency string
- events Sequence[str]
- priorities Sequence[str]
- urgency str
- events List<String>
- priorities List<String>
- urgency String
Import
Slack connections can be imported using the related workspace
ID and the slack_connection
ID separated by a dot, e.g.
$ pulumi import pagerduty:index/slackConnection:SlackConnection main T02A123LV1A.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.