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_resources data source fetches azure monitor action groups ids with not correct casing #25330

Open bytef10w opened 8 months ago

bytef10w commented 8 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.7.3

AzureRM Provider Version

3.90, 3.96.0

Affected Resource(s)/Data Source(s)

azurerm_resources

Terraform Configuration Files

data "azurerm_resources" "action_groups" {
  type                = "Microsoft.Insights/actionGroups"
  resource_group_name = var.resource_group_name
}

resource "azurerm_monitor_smart_detector_alert_rule" "this" {
  name                = "Failure Anomalies - ${var.name}"
  resource_group_name = var.resource_group_name
  detector_type       = "FailureAnomaliesDetector"
  scope_resource_ids  = [azurerm_application_insights.this.id]
  severity            = "Sev2"
  frequency           = "PT1M"
  action_group {
    ids = local.default_action_group != null ? [local.default_action_group.id] : [azurerm_monitor_action_group.this[0].id]
  }

  tags = var.tags
}

Debug Output/Panic Output

Error: ID was missing the `actionGroups` element
│ 
│   with module.law.azurerm_monitor_smart_detector_alert_rule.this,
│   on ../../terraform-azurerm-application-insights/main.tf line 80, in resource "azurerm_monitor_smart_detector_alert_rule" "this":
│   80:     ids = local.default_action_group != null ? [local.default_action_group.id] : [azurerm_monitor_action_group.this[0].id]

Expected Behaviour

Actual Behaviour

Steps to Reproduce

No response

Important Factoids

No response

References

No response

wuxu92 commented 8 months ago

Hi @IharStatkevich , Thanks for filing this issue. AzureRM provider is case sensetive and it validates the id before plan. you post says the local.default_action_group.id raised the issue, but your title says the azurerm_resources fetched a wrong cased id caused the issue. could you please make sure which part of the field caused the issue? I guess the issue is raised by azurerm_monitor_action_group.this[0].id.