Retrieves information about multiple databricks.User resources.
This data source works with both the account-level and workspace-level provider.
Example Usage
Adding a subset of users to a group
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
export = async () => {
const companyUsers = await databricks.getUsers({
filter: "userName co \"@domain.org\"",
});
const dataUsersGroup = new databricks.Group("data_users_group", {displayName: "Data Users"});
const addUsersToGroup: databricks.GroupMember[] = [];
for (const range of Object.entries(.reduce((__obj, user) => ({ ...__obj, [user.id]: user }))).map(([k, v]) => ({key: k, value: v}))) {
addUsersToGroup.push(new databricks.GroupMember(`add_users_to_group-${range.key}`, {
groupId: dataUsersGroup.id,
memberId: range.value.id,
}));
}
}
import pulumi
import pulumi_databricks as databricks
company_users = databricks.get_users(filter="userName co \"@domain.org\"")
data_users_group = databricks.Group("data_users_group", display_name="Data Users")
add_users_to_group = []
for range in [{"key": k, "value": v} for [k, v] in enumerate({user.id: user for user in company_users.users})]:
add_users_to_group.append(databricks.GroupMember(f"add_users_to_group-{range['key']}",
group_id=data_users_group.id,
member_id=%!v(PANIC=Format method: runtime error: index out of range [-1])))
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(async() =>
{
var companyUsers = await Databricks.GetUsers.InvokeAsync(new()
{
Filter = "userName co \"@domain.org\"",
});
var dataUsersGroup = new Databricks.Group("data_users_group", new()
{
DisplayName = "Data Users",
});
var addUsersToGroup = new List<Databricks.GroupMember>();
foreach (var range in .Select(pair => new { pair.Key, pair.Value }))
{
addUsersToGroup.Add(new Databricks.GroupMember($"add_users_to_group-{range.Key}", new()
{
GroupId = dataUsersGroup.Id,
MemberId = range.Value.Id,
}));
}
});
Example coming soon!
resources:
dataUsersGroup:
type: databricks:Group
name: data_users_group
properties:
displayName: Data Users
addUsersToGroup:
type: databricks:GroupMember
name: add_users_to_group
properties:
groupId: ${dataUsersGroup.id}
memberId: ${range.value.id}
options: {}
variables:
companyUsers:
fn::invoke:
function: databricks:getUsers
arguments:
filter: userName co "@domain.org"
Related Resources
The following resources are used in the same context:
- databricks_user: Resource to manage individual users in Databricks.
- databricks_group: Resource to manage groups in Databricks.
- databricks_group_member: Resource to manage group memberships by adding users to groups.
- databricks_permissions: Resource to manage access control in the Databricks workspace.
- databricks_current_user: Data source to retrieve information about the user or service principal that is calling the Databricks REST API.
Using getUsers
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>def get_users(extra_attributes: Optional[str] = None,
filter: Optional[str] = None,
users: Optional[Sequence[GetUsersUser]] = None,
opts: Optional[InvokeOptions] = None) -> GetUsersResult
def get_users_output(extra_attributes: Optional[pulumi.Input[str]] = None,
filter: Optional[pulumi.Input[str]] = None,
users: Optional[pulumi.Input[Sequence[pulumi.Input[GetUsersUserArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput> Note: This function is named GetUsers in the Go SDK.
public static class GetUsers
{
public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
fn::invoke:
function: databricks:index/getUsers:getUsers
arguments:
# arguments dictionaryThe following arguments are supported:
- Extra
Attributes string - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - Filter string
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- Users
List<Get
Users User> - A list of users matching the specified criteria. Each user has the following attributes:
- Extra
Attributes string - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - Filter string
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- Users
[]Get
Users User - A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes String - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - filter String
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- users
List<Get
Users User> - A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes string - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - filter string
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- users
Get
Users User[] - A list of users matching the specified criteria. Each user has the following attributes:
- extra_
attributes str - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - filter str
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- users
Sequence[Get
Users User] - A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes String - A comma-separated list of additional user attributes to include in the results. By default, the data source returns the following attributes:
id,userName,displayName, andexternalId. Use this argument to request additional attributes as needed. The list of all available attributes can be found in the API reference. - filter String
Query by which the results have to be filtered. If not specified, all users will be returned. Supported operators are equals (
eq), contains (co), starts with (sw), and not equals (ne). Additionally, simple expressions can be formed using logical operatorsandandor.Examples:
- User whose
displayNameequals "john":
- User whose
- users List<Property Map>
- A list of users matching the specified criteria. Each user has the following attributes:
getUsers Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Users
List<Get
Users User> - A list of users matching the specified criteria. Each user has the following attributes:
- Extra
Attributes string - Filter string
- Id string
- The provider-assigned unique ID for this managed resource.
- Users
[]Get
Users User - A list of users matching the specified criteria. Each user has the following attributes:
- Extra
Attributes string - Filter string
- id String
- The provider-assigned unique ID for this managed resource.
- users
List<Get
Users User> - A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes String - filter String
- id string
- The provider-assigned unique ID for this managed resource.
- users
Get
Users User[] - A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes string - filter string
- id str
- The provider-assigned unique ID for this managed resource.
- users
Sequence[Get
Users User] - A list of users matching the specified criteria. Each user has the following attributes:
- extra_
attributes str - filter str
- id String
- The provider-assigned unique ID for this managed resource.
- users List<Property Map>
- A list of users matching the specified criteria. Each user has the following attributes:
- extra
Attributes String - filter String
Supporting Types
GetUsersUser
- Active bool
- Boolean that represents if this user is active.
- Display
Name string - Emails
List<Get
Users User Email> - All the emails associated with the Databricks user.
- Entitlements
List<Get
Users User Entitlement> - Entitlements assigned to the user.
- External
Id string - Groups
List<Get
Users User Group> - Indicates if the user is part of any groups.
- Id string
- The ID of the user.
userName- The username of the user.
- Name
Get
Users User Name givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- Roles
List<Get
Users User Role> - Indicates if the user has any associated roles.
- Schemas List<string>
- The schema of the user.
externalId- Reserved for future use.
- User
Name string
- Active bool
- Boolean that represents if this user is active.
- Display
Name string - Emails
[]Get
Users User Email - All the emails associated with the Databricks user.
- Entitlements
[]Get
Users User Entitlement - Entitlements assigned to the user.
- External
Id string - Groups
[]Get
Users User Group - Indicates if the user is part of any groups.
- Id string
- The ID of the user.
userName- The username of the user.
- Name
Get
Users User Name givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- Roles
[]Get
Users User Role - Indicates if the user has any associated roles.
- Schemas []string
- The schema of the user.
externalId- Reserved for future use.
- User
Name string
- active Boolean
- Boolean that represents if this user is active.
- display
Name String - emails
List<Get
Users User Email> - All the emails associated with the Databricks user.
- entitlements
List<Get
Users User Entitlement> - Entitlements assigned to the user.
- external
Id String - groups
List<Get
Users User Group> - Indicates if the user is part of any groups.
- id String
- The ID of the user.
userName- The username of the user.
- name
Get
Users User Name givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- roles
List<Get
Users User Role> - Indicates if the user has any associated roles.
- schemas List<String>
- The schema of the user.
externalId- Reserved for future use.
- user
Name String
- active boolean
- Boolean that represents if this user is active.
- display
Name string - emails
Get
Users User Email[] - All the emails associated with the Databricks user.
- entitlements
Get
Users User Entitlement[] - Entitlements assigned to the user.
- external
Id string - groups
Get
Users User Group[] - Indicates if the user is part of any groups.
- id string
- The ID of the user.
userName- The username of the user.
- name
Get
Users User Name givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- roles
Get
Users User Role[] - Indicates if the user has any associated roles.
- schemas string[]
- The schema of the user.
externalId- Reserved for future use.
- user
Name string
- active bool
- Boolean that represents if this user is active.
- display_
name str - emails
Sequence[Get
Users User Email] - All the emails associated with the Databricks user.
- entitlements
Sequence[Get
Users User Entitlement] - Entitlements assigned to the user.
- external_
id str - groups
Sequence[Get
Users User Group] - Indicates if the user is part of any groups.
- id str
- The ID of the user.
userName- The username of the user.
- name
Get
Users User Name givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- roles
Sequence[Get
Users User Role] - Indicates if the user has any associated roles.
- schemas Sequence[str]
- The schema of the user.
externalId- Reserved for future use.
- user_
name str
- active Boolean
- Boolean that represents if this user is active.
- display
Name String - emails List<Property Map>
- All the emails associated with the Databricks user.
- entitlements List<Property Map>
- Entitlements assigned to the user.
- external
Id String - groups List<Property Map>
- Indicates if the user is part of any groups.
- id String
- The ID of the user.
userName- The username of the user.
- name Property Map
givenName- Given name of the Databricks user.familyName- Family name of the Databricks user.displayName- The display name of the user.
- roles List<Property Map>
- Indicates if the user has any associated roles.
- schemas List<String>
- The schema of the user.
externalId- Reserved for future use.
- user
Name String
GetUsersUserEmail
GetUsersUserEntitlement
GetUsersUserGroup
GetUsersUserName
- Family
Name string - Given
Name string
- Family
Name string - Given
Name string
- family
Name String - given
Name String
- family
Name string - given
Name string
- family_
name str - given_
name str
- family
Name String - given
Name String
GetUsersUserRole
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
databricksTerraform Provider.
