checkly logo
Checkly v1.1.4, Mar 9 23

checkly.AlertChannel

Explore with Pulumi AI

Allows you to define alerting channels for the checks and groups in your account

Example Usage

using Pulumi;
using Checkly = Pulumi.Checkly;

class MyStack : Stack
{
    public MyStack()
    {
        // An Email alert channel
        var emailAc = new Checkly.AlertChannel("emailAc", new Checkly.AlertChannelArgs
        {
            Email = new Checkly.Inputs.AlertChannelEmailArgs
            {
                Address = "john@example.com",
            },
            SendRecovery = true,
            SendFailure = false,
            SendDegraded = true,
            SslExpiry = true,
            SslExpiryThreshold = 22,
        });
        // A SMS alert channel
        var smsAc = new Checkly.AlertChannel("smsAc", new Checkly.AlertChannelArgs
        {
            Sms = new Checkly.Inputs.AlertChannelSmsArgs
            {
                Name = "john",
                Number = "+5491100001111",
            },
            SendRecovery = true,
            SendFailure = true,
        });
        // A Slack alert channel
        var slackAc = new Checkly.AlertChannel("slackAc", new Checkly.AlertChannelArgs
        {
            Slack = new Checkly.Inputs.AlertChannelSlackArgs
            {
                Channel = "#checkly-notifications",
                Url = "https://hooks.slack.com/services/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",
            },
        });
        // An Opsgenie alert channel
        var opsgenieAc = new Checkly.AlertChannel("opsgenieAc", new Checkly.AlertChannelArgs
        {
            Opsgenie = new Checkly.Inputs.AlertChannelOpsgenieArgs
            {
                Name = "opsalerts",
                ApiKey = "fookey",
                Region = "fooregion",
                Priority = "foopriority",
            },
        });
        // An Pagerduty alert channel
        var pagerdutyAc = new Checkly.AlertChannel("pagerdutyAc", new Checkly.AlertChannelArgs
        {
            Pagerduty = new Checkly.Inputs.AlertChannelPagerdutyArgs
            {
                Account = "checkly",
                ServiceKey = "key1",
                ServiceName = "pdalert",
            },
        });
        // An Webhook alert channel
        var webhookAc = new Checkly.AlertChannel("webhookAc", new Checkly.AlertChannelArgs
        {
            Webhook = new Checkly.Inputs.AlertChannelWebhookArgs
            {
                Name = "foo",
                Method = "get",
                Template = "footemplate",
                Url = "https://example.com/foo",
                WebhookSecret = "foosecret",
            },
        });
        // Connecting the alert channel to a check
        var exampleCheck = new Checkly.Check("exampleCheck", new Checkly.CheckArgs
        {
            AlertChannelSubscriptions = 
            {
                new Checkly.Inputs.CheckAlertChannelSubscriptionArgs
                {
                    ChannelId = emailAc.Id,
                    Activated = true,
                },
                new Checkly.Inputs.CheckAlertChannelSubscriptionArgs
                {
                    ChannelId = smsAc.Id,
                    Activated = true,
                },
            },
        });
    }

}
package main

import (
	"github.com/checkly/pulumi-checkly/sdk/go/checkly"
	"github.com/pulumi/pulumi-checkly/sdk/go/checkly"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		emailAc, err := checkly.NewAlertChannel(ctx, "emailAc", &checkly.AlertChannelArgs{
			Email: &AlertChannelEmailArgs{
				Address: pulumi.String("john@example.com"),
			},
			SendRecovery:       pulumi.Bool(true),
			SendFailure:        pulumi.Bool(false),
			SendDegraded:       pulumi.Bool(true),
			SslExpiry:          pulumi.Bool(true),
			SslExpiryThreshold: pulumi.Int(22),
		})
		if err != nil {
			return err
		}
		smsAc, err := checkly.NewAlertChannel(ctx, "smsAc", &checkly.AlertChannelArgs{
			Sms: &AlertChannelSmsArgs{
				Name:   pulumi.String("john"),
				Number: pulumi.String("+5491100001111"),
			},
			SendRecovery: pulumi.Bool(true),
			SendFailure:  pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = checkly.NewAlertChannel(ctx, "slackAc", &checkly.AlertChannelArgs{
			Slack: &AlertChannelSlackArgs{
				Channel: pulumi.String("#checkly-notifications"),
				Url:     pulumi.String("https://hooks.slack.com/services/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"),
			},
		})
		if err != nil {
			return err
		}
		_, err = checkly.NewAlertChannel(ctx, "opsgenieAc", &checkly.AlertChannelArgs{
			Opsgenie: &AlertChannelOpsgenieArgs{
				Name:     pulumi.String("opsalerts"),
				ApiKey:   pulumi.String("fookey"),
				Region:   pulumi.String("fooregion"),
				Priority: pulumi.String("foopriority"),
			},
		})
		if err != nil {
			return err
		}
		_, err = checkly.NewAlertChannel(ctx, "pagerdutyAc", &checkly.AlertChannelArgs{
			Pagerduty: &AlertChannelPagerdutyArgs{
				Account:     pulumi.String("checkly"),
				ServiceKey:  pulumi.String("key1"),
				ServiceName: pulumi.String("pdalert"),
			},
		})
		if err != nil {
			return err
		}
		_, err = checkly.NewAlertChannel(ctx, "webhookAc", &checkly.AlertChannelArgs{
			Webhook: &AlertChannelWebhookArgs{
				Name:          pulumi.String("foo"),
				Method:        pulumi.String("get"),
				Template:      pulumi.String("footemplate"),
				Url:           pulumi.String("https://example.com/foo"),
				WebhookSecret: pulumi.String("foosecret"),
			},
		})
		if err != nil {
			return err
		}
		_, err = checkly.NewCheck(ctx, "exampleCheck", &checkly.CheckArgs{
			AlertChannelSubscriptions: CheckAlertChannelSubscriptionArray{
				&CheckAlertChannelSubscriptionArgs{
					ChannelId: emailAc.ID(),
					Activated: pulumi.Bool(true),
				},
				&CheckAlertChannelSubscriptionArgs{
					ChannelId: smsAc.ID(),
					Activated: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_checkly as checkly

# An Email alert channel
email_ac = checkly.AlertChannel("emailAc",
    email=checkly.AlertChannelEmailArgs(
        address="john@example.com",
    ),
    send_recovery=True,
    send_failure=False,
    send_degraded=True,
    ssl_expiry=True,
    ssl_expiry_threshold=22)
# A SMS alert channel
sms_ac = checkly.AlertChannel("smsAc",
    sms=checkly.AlertChannelSmsArgs(
        name="john",
        number="+5491100001111",
    ),
    send_recovery=True,
    send_failure=True)
# A Slack alert channel
slack_ac = checkly.AlertChannel("slackAc", slack=checkly.AlertChannelSlackArgs(
    channel="#checkly-notifications",
    url="https://hooks.slack.com/services/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",
))
# An Opsgenie alert channel
opsgenie_ac = checkly.AlertChannel("opsgenieAc", opsgenie=checkly.AlertChannelOpsgenieArgs(
    name="opsalerts",
    api_key="fookey",
    region="fooregion",
    priority="foopriority",
))
# An Pagerduty alert channel
pagerduty_ac = checkly.AlertChannel("pagerdutyAc", pagerduty=checkly.AlertChannelPagerdutyArgs(
    account="checkly",
    service_key="key1",
    service_name="pdalert",
))
# An Webhook alert channel
webhook_ac = checkly.AlertChannel("webhookAc", webhook=checkly.AlertChannelWebhookArgs(
    name="foo",
    method="get",
    template="footemplate",
    url="https://example.com/foo",
    webhook_secret="foosecret",
))
# Connecting the alert channel to a check
example_check = checkly.Check("exampleCheck", alert_channel_subscriptions=[
    checkly.CheckAlertChannelSubscriptionArgs(
        channel_id=email_ac.id,
        activated=True,
    ),
    checkly.CheckAlertChannelSubscriptionArgs(
        channel_id=sms_ac.id,
        activated=True,
    ),
])
import * as pulumi from "@pulumi/pulumi";
import * as pulumi from "@checkly/pulumi";

// An Email alert channel
const emailAc = new checkly.AlertChannel("emailAc", {
    email: {
        address: "john@example.com",
    },
    sendRecovery: true,
    sendFailure: false,
    sendDegraded: true,
    sslExpiry: true,
    sslExpiryThreshold: 22,
});
// A SMS alert channel
const smsAc = new checkly.AlertChannel("smsAc", {
    sms: {
        name: "john",
        number: "+5491100001111",
    },
    sendRecovery: true,
    sendFailure: true,
});
// A Slack alert channel
const slackAc = new checkly.AlertChannel("slackAc", {slack: {
    channel: "#checkly-notifications",
    url: "https://hooks.slack.com/services/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",
}});
// An Opsgenie alert channel
const opsgenieAc = new checkly.AlertChannel("opsgenieAc", {opsgenie: {
    name: "opsalerts",
    apiKey: "fookey",
    region: "fooregion",
    priority: "foopriority",
}});
// An Pagerduty alert channel
const pagerdutyAc = new checkly.AlertChannel("pagerdutyAc", {pagerduty: {
    account: "checkly",
    serviceKey: "key1",
    serviceName: "pdalert",
}});
// An Webhook alert channel
const webhookAc = new checkly.AlertChannel("webhookAc", {webhook: {
    name: "foo",
    method: "get",
    template: "footemplate",
    url: "https://example.com/foo",
    webhookSecret: "foosecret",
}});
// Connecting the alert channel to a check
const exampleCheck = new checkly.Check("exampleCheck", {alertChannelSubscriptions: [
    {
        channelId: emailAc.id,
        activated: true,
    },
    {
        channelId: smsAc.id,
        activated: true,
    },
]});

Coming soon!

Create AlertChannel Resource

new AlertChannel(name: string, args?: AlertChannelArgs, opts?: CustomResourceOptions);
@overload
def AlertChannel(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 email: Optional[AlertChannelEmailArgs] = None,
                 opsgenie: Optional[AlertChannelOpsgenieArgs] = None,
                 pagerduty: Optional[AlertChannelPagerdutyArgs] = None,
                 send_degraded: Optional[bool] = None,
                 send_failure: Optional[bool] = None,
                 send_recovery: Optional[bool] = None,
                 slack: Optional[AlertChannelSlackArgs] = None,
                 sms: Optional[AlertChannelSmsArgs] = None,
                 ssl_expiry: Optional[bool] = None,
                 ssl_expiry_threshold: Optional[int] = None,
                 webhook: Optional[AlertChannelWebhookArgs] = None)
@overload
def AlertChannel(resource_name: str,
                 args: Optional[AlertChannelArgs] = None,
                 opts: Optional[ResourceOptions] = None)
func NewAlertChannel(ctx *Context, name string, args *AlertChannelArgs, opts ...ResourceOption) (*AlertChannel, error)
public AlertChannel(string name, AlertChannelArgs? args = null, CustomResourceOptions? opts = null)
public AlertChannel(String name, AlertChannelArgs args)
public AlertChannel(String name, AlertChannelArgs args, CustomResourceOptions options)
type: checkly:AlertChannel
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AlertChannelArgs
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 AlertChannelArgs
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 AlertChannelArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AlertChannelArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AlertChannelArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AlertChannel 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 AlertChannel resource accepts the following input properties:

email Property Map
opsgenie Property Map
pagerduty Property Map
sendDegraded Boolean

(Default false)

sendFailure Boolean

(Default true)

sendRecovery Boolean

(Default true)

slack Property Map
sms Property Map
sslExpiry Boolean

(Default false)

sslExpiryThreshold Number

Value must be between 1 and 30 (Default 30)

webhook Property Map

Outputs

All input properties are implicitly available as output properties. Additionally, the AlertChannel 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 AlertChannel Resource

Get an existing AlertChannel 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?: AlertChannelState, opts?: CustomResourceOptions): AlertChannel
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        email: Optional[AlertChannelEmailArgs] = None,
        opsgenie: Optional[AlertChannelOpsgenieArgs] = None,
        pagerduty: Optional[AlertChannelPagerdutyArgs] = None,
        send_degraded: Optional[bool] = None,
        send_failure: Optional[bool] = None,
        send_recovery: Optional[bool] = None,
        slack: Optional[AlertChannelSlackArgs] = None,
        sms: Optional[AlertChannelSmsArgs] = None,
        ssl_expiry: Optional[bool] = None,
        ssl_expiry_threshold: Optional[int] = None,
        webhook: Optional[AlertChannelWebhookArgs] = None) -> AlertChannel
func GetAlertChannel(ctx *Context, name string, id IDInput, state *AlertChannelState, opts ...ResourceOption) (*AlertChannel, error)
public static AlertChannel Get(string name, Input<string> id, AlertChannelState? state, CustomResourceOptions? opts = null)
public static AlertChannel get(String name, Output<String> id, AlertChannelState 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.
The following state arguments are supported:
email Property Map
opsgenie Property Map
pagerduty Property Map
sendDegraded Boolean

(Default false)

sendFailure Boolean

(Default true)

sendRecovery Boolean

(Default true)

slack Property Map
sms Property Map
sslExpiry Boolean

(Default false)

sslExpiryThreshold Number

Value must be between 1 and 30 (Default 30)

webhook Property Map

Supporting Types

AlertChannelEmail

Address string
Address string
address String
address string
address String

AlertChannelOpsgenie

ApiKey string
Name string
Priority string
Region string
ApiKey string
Name string
Priority string
Region string
apiKey String
name String
priority String
region String
apiKey string
name string
priority string
region string
apiKey String
name String
priority String
region String

AlertChannelPagerduty

ServiceKey string
Account string
ServiceName string
ServiceKey string
Account string
ServiceName string
serviceKey String
account String
serviceName String
serviceKey string
account string
serviceName string
serviceKey String
account String
serviceName String

AlertChannelSlack

Channel string
Url string
Channel string
Url string
channel String
url String
channel string
url string
channel str
url str
channel String
url String

AlertChannelSms

Name string
Number string
Name string
Number string
name String
number String
name string
number string
name str
number str
name String
number String

AlertChannelWebhook

Name string
Url string
Headers Dictionary<string, object>
Method string
QueryParameters Dictionary<string, object>
Template string
WebhookSecret string
Name string
Url string
Headers map[string]interface{}
Method string
QueryParameters map[string]interface{}
Template string
WebhookSecret string
name String
url String
headers Map<String,Object>
method String
queryParameters Map<String,Object>
template String
webhookSecret String
name string
url string
headers {[key: string]: any}
method string
queryParameters {[key: string]: any}
template string
webhookSecret string
name str
url str
headers Mapping[str, Any]
method str
query_parameters Mapping[str, Any]
template str
webhook_secret str
name String
url String
headers Map<Any>
method String
queryParameters Map<Any>
template String
webhookSecret String

Package Details

Repository
checkly checkly/pulumi-checkly
License
MIT
Notes

This Pulumi package is based on the checkly Terraform Provider.