Anonymous
Not applicable

@Nicholas Glen​ :

Yes, it is possible to enable verbose audit logs in Databricks Workspace Settings using Terraform.

You can use the databricks_workspace_cluster_policy resource to create or update a cluster policy that enables verbose audit logs. Here's an example code snippet:

resource "databricks_workspace_cluster_policy" "example_policy" {
  policy_id   = "example_policy"
  policy_name = "Example Policy"
  policy_json = jsonencode({
    "audit_logs": {
      "log_all_users": true,
      "log_all_clusters": true,
      "audit_enabled": true,
      "audit_logs_level": "ALL"
    }
  })
}

In this example, we're creating a new cluster policy with the ID example_policy that enables verbose audit logs for all users and clusters. The policy_json field specifies the JSON representation of the policy, which is a nested object with an audit_logs field that contains the settings for audit logging.

You can then attach this policy to a workspace by using the databricks_workspace_resource

resource with the policy field set to the ID of the policy:

resource "databricks_workspace_resource" "example_workspace" {
  name  = "example_workspace"
  path  = "/"
  policy {
    policy_id = databricks_workspace_cluster_policy.example_policy.policy_id
  }
}

This attaches the example_policy policy to the workspace with the name example_workspace.

Note that enabling verbose audit logs can generate a large amount of log data, so make sure you have adequate storage and log management in place.