terraform-provider-mongodbatlas icon indicating copy to clipboard operation
terraform-provider-mongodbatlas copied to clipboard

MS Teams alert support in terraform provider is missing

Open AdilHoumadi opened this issue 2 years ago • 6 comments

Terraform CLI and Terraform MongoDB Atlas Provider Version

terraform --version
Terraform v0.14.11

mongodbatlas = {
  source  = "mongodb/mongodbatlas"
  version = "1.4.5"
}

Terraform Configuration File

resource "mongodbatlas_third_party_integration" "microsoft_teams" {
  project_id = mongodbatlas_project.project.id
  type = "MICROSOFT_TEAMS"
  microsoft_teams_webhook_url  = "https://xxx.webhook.office.com/webhookb/yyy"
}

resource "mongodbatlas_alert_configuration" "alerts" {
  project_id = mongodbatlas_project.project.id
  enabled    = true
  notification {
    type_name     = "MICROSOFT_TEAMS"
    interval_min  = "15"
    delay_min     = "0"
  }
  depends_on = [mongodbatlas_third_party_integration.microsoft_teams]
}

Steps to Reproduce

$ terraform init
$ terraform apply

Expected Behavior

According to these discussions we should be able to send alarms to MS teams: Correct me if I am missing something! https://feedback.mongodb.com/forums/924145-atlas/suggestions/45194335-ms-teams-alert-support-in-terraform-provider https://feedback.mongodb.com/forums/924145-atlas/suggestions/40505692-integration-with-microsoft-teams

Actual Behavior

Error: expected notification.0.type_name to be one of [EMAIL SMS PAGER_DUTY SLACK FLOWDOCK DATADOG OPS_GENIE VICTOR_OPS WEBHOOK USER TEAM GROUP ORG], got MICROSOFT_TEAMS

https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/mongodbatlas/resource_mongodbatlas_alert_configuration.go#L277-L283

Additional Context

According to this doc: https://www.mongodb.com/docs/cloud-manager/reference/api/alert-configurations-create-config/ We do need the type_name=MICROSOFT_TEAMS to be added to the list. And we should include this param in the notifications list: microsoftTeamsWebhookUrl

notifications.microsoftTeamsWebhookUrl
Microsoft Teams channel incoming webhook URL. if "notifications.typeName" : "MICROSOFT_TEAMS".

AdilHoumadi avatar Sep 08 '22 08:09 AdilHoumadi

Will try to replicate issue using v1.4.5

martinstibbe avatar Sep 14 '22 20:09 martinstibbe

@AdilHoumadi Internal engineering ticket to correct this issue https://jira.mongodb.org/browse/INTMDB-394

martinstibbe avatar Sep 14 '22 23:09 martinstibbe

@martinstibbe Thanks for the feedback! looking forward to the test the fix and get rid of my workaround.

AdilHoumadi avatar Sep 15 '22 08:09 AdilHoumadi

@AdilHoumadi https://github.com/mongodb/terraform-provider-mongodbatlas/tree/INTMDB-394 this branch has the changes if you would like to compile a binary to test in the meantime

martinstibbe avatar Sep 15 '22 12:09 martinstibbe

@martinstibbe Thanks for the test, I will test it and share a feedback!

AdilHoumadi avatar Sep 16 '22 07:09 AdilHoumadi

@AdilHoumadi Added SDK library support for microsoftTeamsWebhookUrl and a few others

martinstibbe avatar Sep 22 '22 02:09 martinstibbe

@AdilHoumadi I have combined this in another fix for this upcoming release v1.5.0 INTMDB-373 Branch has Webhook and MS Teams configuration parameters

martinstibbe avatar Oct 19 '22 02:10 martinstibbe

@AdilHoumadi we have just released v1.5.0, can you let us know if this resolves issue?

Zuhairahmed avatar Nov 08 '22 16:11 Zuhairahmed

@Zuhairahmed, Tested and it's working, Thanks!

AdilHoumadi avatar Jan 03 '23 14:01 AdilHoumadi