@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
144 lines • 6.34 kB
JavaScript
// *** 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.Entitlements = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows you to set entitlements to existing databricks_users, databricks.Group or databricks_service_principal.
*
* > You must define entitlements of a principal using either `databricks.Entitlements` or directly within one of databricks_users, databricks.Group or databricks_service_principal. Having entitlements defined in both resources will result in non-deterministic behaviour.
*
* ## Example Usage
*
* Setting entitlements for a regular user:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const me = databricks.getUser({
* userName: "me@example.com",
* });
* const meEntitlements = new databricks.Entitlements("me", {
* userId: me.then(me => me.id),
* allowClusterCreate: true,
* allowInstancePoolCreate: true,
* });
* ```
*
* Setting entitlements for a service principal:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const _this = databricks.getServicePrincipal({
* applicationId: "11111111-2222-3333-4444-555666777888",
* });
* const thisEntitlements = new databricks.Entitlements("this", {
* servicePrincipalId: _this.then(_this => _this.spId),
* allowClusterCreate: true,
* allowInstancePoolCreate: true,
* });
* ```
*
* Setting entitlements to all users in a workspace - referencing special `users` databricks.Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const users = databricks.getGroup({
* displayName: "users",
* });
* const workspace_users = new databricks.Entitlements("workspace-users", {
* groupId: users.then(users => users.id),
* allowClusterCreate: true,
* allowInstancePoolCreate: true,
* });
* ```
*
* ## 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 can be imported using a synthetic identifier. Examples of valid synthetic identifiers are:
*
* * `user/user_id` - user `user_id`.
*
* * `group/group_id` - group `group_id`.
*
* * `spn/spn_id` - service principal `spn_id`.
*
* bash
*
* ```sh
* $ pulumi import databricks:index/entitlements:Entitlements me user/<user-id>
* ```
*/
class Entitlements extends pulumi.CustomResource {
/**
* Get an existing Entitlements 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 Entitlements(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Entitlements. 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'] === Entitlements.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowClusterCreate"] = state ? state.allowClusterCreate : undefined;
resourceInputs["allowInstancePoolCreate"] = state ? state.allowInstancePoolCreate : undefined;
resourceInputs["databricksSqlAccess"] = state ? state.databricksSqlAccess : undefined;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["servicePrincipalId"] = state ? state.servicePrincipalId : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
resourceInputs["workspaceAccess"] = state ? state.workspaceAccess : undefined;
}
else {
const args = argsOrState;
resourceInputs["allowClusterCreate"] = args ? args.allowClusterCreate : undefined;
resourceInputs["allowInstancePoolCreate"] = args ? args.allowInstancePoolCreate : undefined;
resourceInputs["databricksSqlAccess"] = args ? args.databricksSqlAccess : undefined;
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["servicePrincipalId"] = args ? args.servicePrincipalId : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
resourceInputs["workspaceAccess"] = args ? args.workspaceAccess : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Entitlements.__pulumiType, name, resourceInputs, opts);
}
}
exports.Entitlements = Entitlements;
/** @internal */
Entitlements.__pulumiType = 'databricks:index/entitlements:Entitlements';
//# sourceMappingURL=entitlements.js.map
;