Skip to content

Commit

Permalink
Feat: add email notification support to the schema (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Feb 28, 2024
1 parent 92b9a19 commit 120b27b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type NotificationType string
const (
NotificationTypeSlack NotificationType = "Slack"
NotificationTypeTeams NotificationType = "Teams"
NotificationTypeEmail NotificationType = "Email"
)

type Notification struct {
Expand Down
4 changes: 2 additions & 2 deletions env0/resource_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ func resourceNotification() *schema.Resource {
},
"type": {
Type: schema.TypeString,
Description: "'Slack' or 'Teams'",
Description: "'Slack', 'Teams' or 'Email'",
Required: true,
ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics {
notificationType := client.NotificationType(i.(string))
if notificationType != client.NotificationTypeSlack && notificationType != client.NotificationTypeTeams {
if notificationType != client.NotificationTypeSlack && notificationType != client.NotificationTypeTeams && notificationType != client.NotificationTypeEmail {
return diag.Errorf("Invalid notification type")
}
return nil
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/017_notification/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ resource "env0_notification" "test_notification" {
value = var.second_run ? "https://someotherurl.com" : "https://someurl.com"
}

resource "env0_notification" "test_email_notification" {
name = "email notification ${random_string.random_name.result}"
type = "Email"
value = "[email protected]"
}

resource "env0_project" "test_project" {
name = "Test-Project-For-Notification ${random_string.random_name.result}"
description = "Test Description"
Expand Down

0 comments on commit 120b27b

Please sign in to comment.