databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
456 stars 393 forks source link

[FEATURE] `databricks_budget_policy` resource for workspace-level budget policies #4180

Open Serpinex3 opened 3 weeks ago

Serpinex3 commented 3 weeks ago

Use-cases

Since it is now possible to tag serverless clusters for notebook, job, and dlt using budget policies, it would be nice to be able to provision those using terraform (similar to the cluster policies). Currently, they need to be set by workspace admins in the Compute section of the Workspace Settings.

Attempted Solutions

I tried to use the databricks_budget resource, but this is something different and intended for actual budgets (not policies for tagging) on the account level.

Proposal

The changes could look something like this:

databricks_budget_policy

resource "databricks_budget_policy" "example" {
    name = "Example Policy"

    tag { # At least one tag is required
        key = "foo"
        value = "bar"
    }

    tag {
        key = "baz"
        value = "qux"
    }
}

databricks_permission

resource "databricks_permissions" "example" {
    budget_policy_id = databricks_budget_policy.example.id

    access_control {
        user_name = "xyz"
        permission_level = "CAN_USE" # or "CAN_MANAGE"
    }
}

References

alexott commented 3 weeks ago

There is no API yet.