title: Enabling Activity Logs Diagnostic Settings using Terraform
body: <p>Currently there exists a module to create a Log Diagnostic Setting for Azure Resources linked <a href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting" rel="nofollow noreferrer">here</a>. Using the portal I am able to generate a log diagnostic setting for activity logs as well as mentioned <a href="https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log" rel="nofollow noreferrer">here</a>. I was trying to enable activity logs diagnostic settings and send logs to a Storage account and only came across this <a href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_log_profile" rel="nofollow noreferrer">module</a>.</p>
  <p>However it seems that it is not possible to use this module to send Activity logs to a Log analytics workspace. It also does not support the Log categories which are mentioned in the portal (i.e <code>Administrative</code>,<code>Security</code>, <code>ServiceHealth</code> etc) and only provides <code>Action</code>,<code>Delete</code> and <code>Write</code>. This leads me to believe that they are not intended to be used for the same purpose. The first module requires a <code>target_resource_id</code> and since Activity logs exist in the subscription level no such id exists.</p>
  <p>As such is it possible to use the first mentioned module, or an entirely different module to enable diagnostic settings? Any help regarding the matter would be appreciated</p>