Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 3.27 KB

service_principals.md

File metadata and controls

59 lines (41 loc) · 3.27 KB
subcategory
Security

databricks_service_principals Data Source

-> Note If you have a fully automated setup with workspaces created by databricks_mws_workspaces or azurerm_databricks_workspace, please make sure to add depends_on attribute in order to prevent default auth: cannot configure default credentials errors.

Retrieves application_ids of all databricks_service_principal based on their display_name

Example Usage

Adding all service principals of which display name contains my-spn to admin group

data "databricks_group" "admins" {
  display_name = "admins"
}

data "databricks_service_principals" "spns" {
  display_name_contains = "my-spn"
}

data "databricks_service_principal" "spn" {
  for_each       = toset(data.databricks_service_principals.spns.application_ids)
  application_id = each.value
}

resource "databricks_group_member" "my_member_spn" {
  for_each  = toset(data.databricks_service_principals.spns.application_ids)
  group_id  = data.databricks_group.admins.id
  member_id = data.databricks_service_principal.spn[each.value].sp_id
}

Argument Reference

Data source allows you to pick service principals by the following attributes

Attribute Reference

Data source exposes the following attributes:

  • application_ids - List of application_ids of service principals Individual service principal can be retrieved using databricks_service_principal data source

Related Resources

The following resources are used in the same context: