hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

azurerm_monitor_alert_prometheus_rule_group - when setting severity = 0, severity ends up getting set to 4 #27403

Open rjlce opened 2 months ago

rjlce commented 2 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.3

AzureRM Provider Version

4.2.0

Affected Resource(s)/Data Source(s)

azurerm_monitor_alert_prometheus_rule_group

Terraform Configuration Files

terraform {
  required_version = ">= 0.14"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "4.2.0"
    }
  }
}

Debug Output/Panic Output

N/A

Expected Behaviour

When creating a rule, setting severity = 0 should result in the severity being set to 0 on the rule.

Actual Behaviour

When creating a rule, setting severity = 0 ends up with the rule having a severity of 4.

Steps to Reproduce

No response

Important Factoids

I am using terragrunt

References

No response

Chambras commented 2 months ago

Hi @rjlce could you share the whole terraform script you are using? I will try to reproduce it on my end as well.

rjlce commented 2 months ago

Hi @rjlce could you share the whole terraform script you are using? I will try to reproduce it on my end as well.

Hi @Chambras,

Thanks very much for the support! I've attached a sample terraform script where the issue is occurring. I am running it via terragrunt, but only using terragrunt to set up the root configurations. I've included the terragrunt file as well for your reference.

I've redacted any sensitive information, but I assume you can fill that information in for testing on your end.

Also, below are screenshots showing that the output from running the terraform indicates that severity will be set to 0, but once it's created, it shows severity is set to 4 in the Azure portal.

Screenshot 2024-09-17 at 11 12 17 AM Screenshot 2024-09-17 at 11 12 52 AM

Please let me know if you need any additional information.

Thanks again!

main.tf.txt terragrunt.hcl.txt

rjlce commented 1 month ago

Hi @Chambras,

A friendly follow-up to see if you had any updates on this. My team is managing multiple prometheus rule groups across different Azure Monitor Workspaces using the terraform, but this bug is a pretty big burden since anytime we re-apply our terraform, we have to go into the Azure portal and manually re-update the severity from Sev4 to Sev0 for any Sev0 alerts.