2
votes

I am successfully deploying an Azure Data Factory instance and enabling Diagnostic Settings for Azure Monitor and Log Analytics using Terraform. In the Azure Portal I can see that, for Data Factory, one can select the destination table where data will be stored in Log Analytics: either "Azure Diagnostics" or "Resource Specific", which seems to be recommended.

enter image description here

By default, the "Azure diagnostics" option is set.

How can I set the destination table to "Resource specific" in my Terraform code? I could not find anything in the documentation indicating how to do so.

Here is my code:

# Azure Data Factory diagnostic settings
resource "azurerm_monitor_diagnostic_setting" "edp_adf" {
  name                       = azurerm_data_factory.edp.name
  target_resource_id         = azurerm_data_factory.edp.id
  log_analytics_workspace_id = data.azurerm_log_analytics_workspace.cloud_services.id

  log {
    category = "ActivityRuns"
    enabled  = true

    retention_policy {
      enabled = true
      days    = 31
    }
  }

  log {
    category = "PipelineRuns"
    enabled  = true

    retention_policy {
      enabled = true
      days    = 31
    }
  }

  log {
    category = "TriggerRuns"
    enabled  = true

    retention_policy {
      enabled = true
      days    = 31
    }
  }

  metric {
    category = "AllMetrics"

    retention_policy {
      enabled = true
      days    = 7
    }
  }
}
1
it might not be possible with tf yet4c74356b41

1 Answers

1
votes

This is indeed possible now with the azurerm provider version 1.33.0

Just add:

log_analytics_destination_type = "Dedicated"

to the Terraform code shown in the question.