Add option to create project without alerts
Currently a project is created with a set of default alerts. We need to customize these but we can only add new alerts via terraform. It would be helpful if there was a boolean flag in the mongodbatlas_project resource to disable default alert creation
Just added in the latest version 1.1.1: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/project#with_default_alerts_settings
-
Thank you Nischal for the confirmation. Will update with any progress here.
-
Nischal commented
Hi Melissa,
Adding a boolean flag in the terraform resource + having the underlying API handle that appropriately sounds about like what I would have expected.
Regarding the default alerts, it was someone else who brought it up, but I think the need is simply to "transcribe" the configuration for the default alerts set up by Atlas into terraform HCL and have them available as part of the documentation to copy-paste. Perhaps as a "guide" here: https://github.com/mongodb/terraform-provider-mongodbatlas/tree/master/website/docs/guides which shows up in the terraform registry website. Its probably best that someone on your end does that, but its probably less than an hour worth of work to do it so I'm happy to volunteer to contribute that if needed.
Regards,
Nischal
-
Hi all, I'm the Product Manager for our Terraform provider and want to thank everyone for the great feedback via the suggestion and to Andrew's question. I'd like to share some information and then ask for further input.
Currently when you create a project via the Atlas API or UI a default set of recommended alerts is created. As the provider uses the API the alerts are created but since Terraform did not create them the only way, as noted here, to manage them in Terraform is to create a resource for each alert and import them.
There are a few possible ways to solve this and based on my experience the suggested solution here, to create an API parameter for projects to allow one to set auto alert creation to false, creating no alerts is likely the best. Do all agree this would be a good solution for your use case? Any concerns around this you’d like to surface?
Once concern/ask raised here is that if we do allow the ability to turn alert auto creation off that we provide examples of the current default alerts for Terraform, as they are a great set of alerts to start with. One possibility would be for someone to contribute their Terraform configuration for the current default alerts to the repository and contributors can maintain/add to them over time (https://github.com/mongodb/terraform-provider-mongodbatlas). Would be curious if any would like to contribute in this way?
Again thank you all for the feedback. -Melissa
-
Jork commented
The use case that we have is that we want to change the behavior for the default alerts and manage this in terraform. We don't want to get rid of the default alerts since they are valuable.
The default behavior of mailing is too loudly as it mails everyone that is part of the project. As a start a Slack implementation and later Pagerduty is our preferred way.
In the current state we have to terraform import all 12 alerts for each project, after project creation, before we can make any further changes.
If its decided that a project will get created without alerts could you at least provide the terraform template for the 12 alerts which customers can then add to their code?
-
Nischal commented
Hi Andrew,
We are spinning up and managing projects programmatically, we need to be able to tune the alerts on a project by project basis. This applies to both prod and nonprod projects. Right now the alerts created are outside of the purview of terraform so we either have to manually import each one, or write a provisioner to get rid of the default set and create our own set that we can then manage via terraform.
Customizing destination will also definitely play into this. Currently the default alerts trigger hundreds of emails to my team a day, so they are just noise at that point and ignored. In the near future we will likely disable the emails, send the notification to datadog and manage who gets pinged there.
-
Martin commented
Hi Andrew,
I am adding some information as I worked with another customer that had the same issue.
The issue of creating default alerts when creating a project is that those alerts are not defined in the Terraform code, in fact some people are not even aware those alerts are created when a new project is create since it wasn't defined in the Terraform code.
This is a problem to customers who want to manage alerts in general, because when running the Terraform code, it will fail if it finds that particular alert already present on the Atlas project, which was not create via Terraform and therefore it is not present in the Terraform state file.
Ideally, the project resource should have a flag that is set to 'false' by default to not create alerts when creating a project.
Does that make sense?
Regards,
Martin -
Hi Nischal,
Can you add some color around the use case: is the reason you're aiming to disable alerts that you're spinning up a non-prod project programmatically and just don't want to be bothered by any alerts? Or rather that you just want a completely separate set of alerts than the default; if the latter do we potentially have the wrong defaults? or is it more that you want to customize destinations (not email) and that kind of thing? Appreciate ay extra perspective here.
Thanks
-Andrew