Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for signl4 alarms recipient #255

Merged
merged 7 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cloudamqp/resource_cloudamqp_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ func resourceNotification() *schema.Resource {
Description: "Instance identifier",
},
"type": {
Type: schema.TypeString,
Required: true,
Description: "Type of the notification, valid options are: email, webhook, pagerduty, victorops, opsgenie, opsgenie-eu, slack, teams",
Type: schema.TypeString,
Required: true,
Description: "Type of the notification, valid options are: email, opsgenie, opsgenie-eu," +
"pagerduty, slack, signl4, teams, victorops, webhook",
ValidateFunc: validateNotificationType(),
},
"value": {
Expand Down Expand Up @@ -134,13 +135,14 @@ func resourceNotificationDelete(d *schema.ResourceData, meta interface{}) error
func validateNotificationType() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
"email",
"webhook",
"pagerduty",
"victorops",
"opsgenie",
"opsgenie-eu",
"pagerduty",
"signl4",
"slack",
"teams",
"victorops",
"webhook",
}, true)
}

Expand Down
117 changes: 103 additions & 14 deletions docs/resources/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,44 @@ Available for all subscription plans.

## Example Usage

<details>
<summary>
<b>Email recipient</b>
</summary>

```hcl
# New recipient to receieve notifications
resource "cloudamqp_notification" "email_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "email"
value = "[email protected]"
name = "alarm"
}
```

resource "cloudamqp_notification" "victorops_recipient" {
</details>

<details>
<summary>
<b>OpsGenie recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "opsgenie_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "victorops"
value = "<UUID>"
name = "Victorops"
options = {
"rk" = "ROUTINGKEY"
}
type = "opsgenie" # or "opsgenie-eu"
value = "<api-key>"
name = "OpsGenie"
}
```

</details>

<details>
<summary>
<b>Pagerduty recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "pagerduty_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "pagerduty"
Expand All @@ -43,6 +62,75 @@ resource "cloudamqp_notification" "pagerduty_recipient" {
}
```

</details>

<details>
<summary>
<b>Signl4 recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "signl4_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "signl4"
value = "<team-secret>"
name = "Signl4"
}
```

</details>

<details>
<summary>
<b>Teams recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "teams_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "teams"
value = "<teams-webhook-url>"
name = "Teams"
}
```

</details>

<details>
<summary>
<b>Victorops recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "victorops_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "victorops"
value = "<integration-key>"
name = "Victorops"
options = {
"rk" = "ROUTINGKEY"
}
}
```

</details>

<details>
<summary>
<b>Webhook recipient</b>
</summary>

```hcl
resource "cloudamqp_notification" "webhook_recipient" {
instance_id = cloudamqp_instance.instance.id
type = "webhook"
value = "<webhook-url>"
name = "Webhook"
}
```

</details>

## Argument Reference

The following arguments are supported:
Expand All @@ -64,19 +152,20 @@ All attributes reference are computed
Valid options for notification type.

* email
* webhook
* pagerduty
* victorops
* opsgenie
* opsgenie-eu
* pagerduty
* signl4
* slack
* teams
* victorops
* webhook

## Options parameter

| Type | Options | Description | Note |
|-----------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| Victorops | rk | Routing key to route alarm notification | - |
| Type | Options | Description | Note |
|---|---|---|---|
| Victorops | rk | Routing key to route alarm notification | - |
| PagerDuty | dedupkey | Default the dedup key for PagerDuty is generated depending on what alarm has triggered, but here you can set what `dedup` key to use so even if the same alarm is triggered for different resources you only get one notification. Leave blank to use the generated dedup key. | If multiple alarms are triggered using this recipient, since they all share `dedup` key only the first alarm will be shown in PagerDuty |

## Dependency
Expand Down