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

'azurerm_monitor_metric_alert' attribute 'scopes' is not working with multiple values #6895

Closed
rapster83 opened this issue May 13, 2020 · 2 comments

Comments

@rapster83
Copy link

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

Terraform (and AzureRM Provider) Version

Terraform v0.12.24
+ provider.azurerm v2.9.0

Affected Resource(s)

azurerm_monitor_metric_alert

Terraform Configuration Files

Example:

resource "azurerm_monitor_metric_alert" "mon_metric_alert" {
  name                = "AppService-diskSpace-Sev1"
  resource_group_name = azurerm_resource_group.location1[0].name
  scopes              = ["/subscriptions/93888cb3-6d3e-4f81-806b-55a19356d689/resourceGroups/rg-company-vm-ad/providers/Microsoft.Compute/virtualMachines/vm-company-ad01",
                         "/subscriptions/93888cb3-6d3e-4f81-806b-55a19356d689/resourceGroups/rg-company-vm-adds/providers/Microsoft.Compute/virtualMachines/vm-company-vmdc01"]
  description         = "Disk space over 90 percent"
  window_size         = "PT6H"
  frequency           = "PT1H"

  criteria {
    metric_namespace = "Microsoft.Web/sites"
    metric_name      = "FileSystemUsage"
    aggregation      = "Average"
    operator         = "GreaterThan"
    threshold        = 241591910400 # 90% of 250Gb in bytes
  }
  severity         = 1
}

Debug Output

None

Panic Output

None

Expected Behavior

Create the metric alert for both scopes in the list.

Actual Behavior

Error message that only 1 item is supported for the scopes attribute.

Error: scopes: attribute supports 1 item maximum, config has 2 declared

  on ..\..\..\..\Modules\Azure\MON\MON_Metric_Alert\main.tf line 5, in resource "azurerm_monitor_metric_alert" "mon_metric_alert":
   5: resource "azurerm_monitor_metric_alert" "mon_metric_alert" {

But the scopes attribute is declared as " A set of strings of resource IDs at which the metric criteria should be applied."

Therefore, multiple values in the list must be possible.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

https://stackoverflow.com/questions/60812471/using-splat-operator-in-terraform-azurerm-monitor-metric-alert-scope-setting

@magodo
Copy link
Collaborator

magodo commented May 26, 2020

Thank you for letting us know this issue 👍
This is a historical issue that Azure Go SDK doesn't support multiple scopes at the early version, so we added a max item limit to 1 to avoid the potential error. However, this is not the case for now.
There is already an issue #3719 to track to support multiple scopes, which you can subscribe to for any update. I hope you don't mind that I close this issue reducing duplication.

@magodo magodo closed this as completed May 26, 2020
@ghost
Copy link

ghost commented Jun 25, 2020

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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants