UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

177 lines 9.2 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.User = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * This resource allows you to manage [users in Databricks Workspace](https://docs.databricks.com/administration-guide/users-groups/users.html), [Databricks Account Console](https://accounts.cloud.databricks.com/) or [Azure Databricks Account Console](https://accounts.azuredatabricks.net). You can also associate Databricks users to databricks_group. Upon user creation the user will receive a welcome email. You can also get information about caller identity using databricks.getCurrentUser data source. * * > To assign account level users to workspace use databricks_mws_permission_assignment. * * > Entitlements, like, `allowClusterCreate`, `allowInstancePoolCreate`, `databricksSqlAccess`, `workspaceAccess` applicable only for workspace-level users. Use databricks.Entitlements resource to assign entitlements inside a workspace to account-level users. * * To create users in the Databricks account, the provider must be configured with `host = "https://accounts.cloud.databricks.com"` on AWS deployments or `host = "https://accounts.azuredatabricks.net"` and authenticate using AAD tokens on Azure deployments. * * The default behavior when deleting a `databricks.User` resource depends on whether the provider is configured at the workspace-level or account-level. When the provider is configured at the workspace-level, the user will be deleted from the workspace. When the provider is configured at the account-level, the user will be deactivated but not deleted. When the provider is configured at the account level, to delete the user from the account when the resource is deleted, set `disableAsUserDeletion = false`. Conversely, when the provider is configured at the account-level, to deactivate the user when the resource is deleted, set `disableAsUserDeletion = true`. * * ## Example Usage * * Creating regular user: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const me = new databricks.User("me", {userName: "me@example.com"}); * ``` * * Creating user with administrative permissions - referencing special `admins` databricks.Group in databricks.GroupMember resource: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const admins = databricks.getGroup({ * displayName: "admins", * }); * const me = new databricks.User("me", {userName: "me@example.com"}); * const i_am_admin = new databricks.GroupMember("i-am-admin", { * groupId: admins.then(admins => admins.id), * memberId: me.id, * }); * ``` * * Creating user with cluster create permissions: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const me = new databricks.User("me", { * userName: "me@example.com", * displayName: "Example user", * allowClusterCreate: true, * }); * ``` * * Creating user in AWS Databricks account: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const accountUser = new databricks.User("account_user", { * userName: "me@example.com", * displayName: "Example user", * }); * ``` * * Creating user in Azure Databricks account: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const accountUser = new databricks.User("account_user", { * userName: "me@example.com", * displayName: "Example user", * }); * ``` * * ## Related Resources * * The following resources are often used in the same context: * * * End to end workspace management guide. * * databricks.Group to manage [groups in Databricks Workspace](https://docs.databricks.com/administration-guide/users-groups/groups.html) or [Account Console](https://accounts.cloud.databricks.com/) (for AWS deployments). * * databricks.Group data to retrieve information about databricks.Group members, entitlements and instance profiles. * * databricks.GroupInstanceProfile to attach databricks.InstanceProfile (AWS) to databricks_group. * * databricks.GroupMember to attach users and groups as group members. * * databricks.InstanceProfile to manage AWS EC2 instance profiles that users can launch databricks.Cluster and access data, like databricks_mount. * * databricks.User data to retrieve information about databricks_user. * * ## Import * * The resource scim user can be imported using id: * * bash * * ```sh * $ pulumi import databricks:index/user:User me <user-id> * ``` */ class User extends pulumi.CustomResource { /** * Get an existing User resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new User(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of User. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === User.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aclPrincipalId"] = state ? state.aclPrincipalId : undefined; resourceInputs["active"] = state ? state.active : undefined; resourceInputs["allowClusterCreate"] = state ? state.allowClusterCreate : undefined; resourceInputs["allowInstancePoolCreate"] = state ? state.allowInstancePoolCreate : undefined; resourceInputs["databricksSqlAccess"] = state ? state.databricksSqlAccess : undefined; resourceInputs["disableAsUserDeletion"] = state ? state.disableAsUserDeletion : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["externalId"] = state ? state.externalId : undefined; resourceInputs["force"] = state ? state.force : undefined; resourceInputs["forceDeleteHomeDir"] = state ? state.forceDeleteHomeDir : undefined; resourceInputs["forceDeleteRepos"] = state ? state.forceDeleteRepos : undefined; resourceInputs["home"] = state ? state.home : undefined; resourceInputs["repos"] = state ? state.repos : undefined; resourceInputs["userName"] = state ? state.userName : undefined; resourceInputs["workspaceAccess"] = state ? state.workspaceAccess : undefined; } else { const args = argsOrState; if ((!args || args.userName === undefined) && !opts.urn) { throw new Error("Missing required property 'userName'"); } resourceInputs["aclPrincipalId"] = args ? args.aclPrincipalId : undefined; resourceInputs["active"] = args ? args.active : undefined; resourceInputs["allowClusterCreate"] = args ? args.allowClusterCreate : undefined; resourceInputs["allowInstancePoolCreate"] = args ? args.allowInstancePoolCreate : undefined; resourceInputs["databricksSqlAccess"] = args ? args.databricksSqlAccess : undefined; resourceInputs["disableAsUserDeletion"] = args ? args.disableAsUserDeletion : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["externalId"] = args ? args.externalId : undefined; resourceInputs["force"] = args ? args.force : undefined; resourceInputs["forceDeleteHomeDir"] = args ? args.forceDeleteHomeDir : undefined; resourceInputs["forceDeleteRepos"] = args ? args.forceDeleteRepos : undefined; resourceInputs["home"] = args ? args.home : undefined; resourceInputs["repos"] = args ? args.repos : undefined; resourceInputs["userName"] = args ? args.userName : undefined; resourceInputs["workspaceAccess"] = args ? args.workspaceAccess : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(User.__pulumiType, name, resourceInputs, opts); } } exports.User = User; /** @internal */ User.__pulumiType = 'databricks:index/user:User'; //# sourceMappingURL=user.js.map