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

r/application_insights: Terraform should remove the automatically created nested items post-creation #10563

Closed
ghost opened this issue Feb 12, 2021 · 5 comments · Fixed by #15892

Comments

@ghost
Copy link

ghost commented Feb 12, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

This issue is a direct followup to #8812 as I think you completly missed the point of that issue.

Whenever a new insights resource is created via azurerm_application_insights azure automatically creates an alert rule called "Failure Anomalies" with the condition "Whenever the Failure Anomalies criteria is met" and an action group "Application Insights Smart Detection" which is also automatically created. (NB: It takes several minutes for this rule to show up in the portal after insights is created)

As Roshan B pointed out this creates a high volume of undesired alert messages sent to the wrong people.

What Roshan B wanted in his issue was the ability to turn off the creation of that alert rule

So it would be great if we could get a way to disable these alerts in azurerm_application_insights resource.

What you instead delivered in your fix was the option to create more of them. 😮

To make things worse, that "Failure Anomalies" rule and "Application Insights Smart Detection" alert group are completly outside of terraforms control. They are not accessible as a resource and thus cannot easily be altered (like changing the action group). You have to fiddle with az CLI call and/or ARM templates to get a grip on that alert rule. This is far from the stable automation process I'd like to achieve with terraform.

New or Affected Resource(s)

  • azurerm_application_insights
  • azurerm_application_insights_smart_detection_rule

Potential Terraform Configuration

resource "azurerm_application_insights" "shared" {
  name                = "randd-fakeapp-ai"
  location            = var.location
  resource_group_name = var.resource_group_name
  application_type    = "other" # 'other' means that a general instance is to be created
  tags                = var.tags

  auto_create_failure_anomalies_rule = false   <<<< some option like this would be nice
}

References

https://docs.microsoft.com/en-us/azure/azure-monitor/app/proactive-failure-diagnostics#how-it-works

@tombuildsstuff
Copy link
Contributor

Rather than exposing a flag for this, Terraform should remove the ones being created by default here - since we've got a means of creating these via the new resource (this is an issue across other resources too, for example placeholder data which shouldn't be provisioned by default, but Azure tries to be helpful)

@tombuildsstuff tombuildsstuff changed the title Support for [thing] Improved handling of smart detection functionality of azure app insights r/application_insights: Terraform should remove the automatically created nested items post-creation Feb 12, 2021
@Simonzhaohui
Copy link

Any workaround to remove the failure anomalies rule ?

@tombuildsstuff tombuildsstuff added this to the v3.0.0 milestone Nov 16, 2021
@ppanyukov
Copy link
Contributor

This has been bugging me for while. We have tons of these "Smart detection" things scattered around in our subscriptions and nobody knows what they are and what to do with them.

One problem I see is that terraform provider is only a thin wrapper on top of Azure RM API, and the API for App Insights has no mention of anything "Smart detection". So I'm not sure if the provider team will be able to implement this feature. I'm sad. See here: https://docs.microsoft.com/en-us/rest/api/application-insights/components/create-or-update

@github-actions
Copy link

This functionality has been released in v3.0.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.