Skip to content

data-platform-hq/terraform-databricks-databricks-account-groups

Repository files navigation

Databricks Account Groups Terraform module

Terraform module for creation Databricks Account Groups and assignments to the Databricks Premium Workspace

Usage

Current module allows you to create groups in the Databricks Account, add users and service principals as a members of those groups. This module also provides an ability to assign just created or already existing Account Groups to the Databricks Workspace.

In order to operate at the Account level the following required_providers block should be configured first:

terraform {
  required_providers {
    databricks = {
      source  = "databricks/databricks"
      version = ">=1.14.2"
    }
  }
}

provider "databricks" {
  alias = "manager"

  host       = "https://accounts.azuredatabricks.net"
  
  # Databricks Account UUID
  account_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
}

Here is an example of using this module to create Account Groups and then assign them to the Workspace:

data "azurerm_databricks_workspace" "example" {
  name                = "example-workspace"
  resource_group_name = "example-rg"
}

module "databricks_account_groups" {
  providers = {
    databricks = databricks.manager
  }

  # Databricks Account groups creation
  groups = [{
    name               = "test_group1"
    users              = ["[email protected]", "[email protected]"]
    service_principals = ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
    }, {
    name  = "test_group2"
    users = ["[email protected]", "[email protected]"]
  }]

  # Databricks Account groups assignment to certain Workspace
  workspace_id = data.azurerm_databricks_workspace.example.id
  
  workspace_group_assignment = [{
    group_name  = "test_group1"
    permissions = ["ADMIN"]
    }, {
    group_name  = "test_group2",
    permissions = ["USER"]
  }]
}

Requirements

Name Version
terraform >=1.0.0
databricks >=1.14.2

Providers

Name Version
databricks >=1.14.2

Modules

No modules.

Resources

Name Type
databricks_group.this resource
databricks_group_member.this resource
databricks_mws_permission_assignment.this resource
databricks_group.this data source
databricks_service_principal.this data source
databricks_user.this data source

Inputs

Name Description Type Default Required
groups List of objects with these parameters - group names to create, sets of users and/or service principals assigned to these groups
list(object({
name = optional(string)
users = optional(set(string))
service_principals = optional(set(string))
}))
[] no
workspace_group_assignment List of objects with group name and list of workspace permissions (USER or ADMIN) to assign to this group
list(object({
group_name = optional(string),
permissions = optional(list(string))
}))
[] no
workspace_id The ID of the Databricks Workspace where Databricks Account group would be assigned string null no

Outputs

No outputs.

License

Apache 2 Licensed. For more information please see LICENSE

About

Terraform module for creation Databricks Account Groups and assignments to the Databricks Premium Workspace

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages