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

Azure azurerm_monitor_metric_alert aggregation now have Count as well #3039

Closed
MMalikKhan opened this issue Mar 13, 2019 · 4 comments · Fixed by #3047
Closed

Azure azurerm_monitor_metric_alert aggregation now have Count as well #3039

MMalikKhan opened this issue Mar 13, 2019 · 4 comments · Fixed by #3047

Comments

@MMalikKhan
Copy link

MMalikKhan commented Mar 13, 2019

Terraform (and AzureRM Provider) Version

Terraform v0.11.11

  • provider.azurerm v1.22.1

Affected Resource(s)

  • azurerm_monitor_metric_alert

Terraform Configuration Files

resource "azurerm_monitor_metric_alert" "metric_alert" {
  name = "testapp-dev-failed-request-alert"
  resource_group_name = "resource_group_name"
  scopes              = "azure app insights"
  description         = "Application has triggered alert"

  severity    = 3
  enabled     = true
  frequency   = "PT1M"
  window_size = "PT5M"

  criteria {
    metric_namespace = "microsoft.insights/components"
    metric_name      = "requests/failed"
    aggregation      = "Total"
    operator         = "GreaterThanOrEqual"
    threshold        = 1
  }

  action {
    action_group_id = "a_valid_action_group"
  }

}

Expected Behavior

Aggregation property should allow Count as well

Error

  • module.appinsights_alerts.azurerm_monitor_metric_alert.metric_alert: 1 error(s) occurred:

  • azurerm_monitor_metric_alert.metric_alert: Error creating or updating metric alert "testapp-dev-failed-request-alert" (resource group ""): insights.MetricAlertsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Time aggregation must be one of [Count]."

Actual Behavior

terraform only allows below values for Aggregation in alert

aggregation - (Required) The statistic that runs over the metric values. Possible values are Average, Minimum, Maximum and Total.

Cannot specify Count in the metric alert

Steps to Reproduce

  1. terraform apply

References

https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftinsightscomponents

If you check above link, failed/request support only Count as aggregation value in the metric alert.

Is there any way i can get around this issue at the moment ?

@MMalikKhan
Copy link
Author

MMalikKhan commented Mar 13, 2019

Hi @tombuildsstuff @JunyiYi , any luck you can comment on the above issue and let me know what can be done to get count to be used in aggregation?

@MMalikKhan
Copy link
Author

Thank you very much @tombuildsstuff , is there any timeline when v1.24.0 will be released?

@ghost
Copy link

ghost commented Apr 3, 2019

This has been released in version 1.24.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.24.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 14, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants