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_diagnostic_setting": parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups" #18346

Closed
1 task done
J0F3 opened this issue Sep 12, 2022 · 4 comments · Fixed by #18467

Comments

@J0F3
Copy link

J0F3 commented Sep 12, 2022

Is there an existing issue for this?

  • I have searched the existing issues

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 Version

1.2.9

AzureRM Provider Version

3.22.0

Affected Resource(s)/Data Source(s)

azurerm_monitor_diagnostic_setting

Terraform Configuration Files

resource "azurerm_monitor_diagnostic_setting" "diag_setting" {
  name                       = "audit-log"
  target_resource_id         = var.resourceid
  log_analytics_workspace_id = var.audit_log_law_id

  log {
    category = "AuditEvent"
    enabled  = true

    retention_policy {
      days    = 0
      enabled = false
    }
  }
  metric {
    category = "AllMetrics"
    enabled  = false
    retention_policy {
      enabled = false
    }
  }
}

Debug Output/Panic Output

Error: parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

Expected Behaviour

Should work.

Basically same issue as #18235.
But it seems it was fixed in 3.22.0 for azurerm_log_analytics_solution only. So filing an other issue for azurerm_monitor_diagnostic_setting resource which has the same problem which needs a fix as well.

Actual Behaviour

New configuration (were persumumely no state is present) it works but for existing configuration / deployment with an existing state terraform apply or plan fails with the error: "parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups""

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@cvs79
Copy link

cvs79 commented Sep 16, 2022

Any updates on this as this essentially blocks us from moving forward in versions. Last working version is azurerm 3.18

@J0F3
Copy link
Author

J0F3 commented Sep 16, 2022

@cvs79
A workaround I found is to specify the Resouce Id for the Log Analytics Workspace (var.audit_log_law_id in the example above) with the casing the provider expects:
e.g.:
/subscriptions/220f340e-843d-4799-8b2d-99e74b1198d2/resourceGroups/testing-rg/providers/Microsoft.OperationalInsights/workspaces/testing-law

instead of

/subscriptions/220f340e-843d-4799-8b2d-99e74b1198d2/resourcegroups/testing-rg/providers/microsoft.operationalinsights/workspaces/testing-law

Then delete the Diagnostic Setting in Azure and run terraform apply again with the current version of azurerm.
The Diagnostic Setting should then get created again with the case sensitive Resouce IDs and the issue should not occur anymore.

Maybe that helps.

favoretti added a commit to favoretti/terraform-provider-azurerm that referenced this issue Sep 21, 2022
`azurerm_monitor_diagnostic_settings`: fix casing parsing
`azurerm_user_assigned_identity`: fix casing parsing
`azurerm_security_center_workspace`: fix casing parsing

Fixes hashicorp#18346
Fixes hashicorp#14853
Fixes hashicorp#18360
@github-actions github-actions bot added this to the v3.24.0 milestone Sep 22, 2022
@github-actions
Copy link

This functionality has been released in v3.24.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 Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants