databricks.UserRole
Explore with Pulumi AI
This resource allows you to attach a role or databricks.InstanceProfile (AWS) to databricks_user.
Example Usage
Adding AWS instance profile to a user
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
const instanceProfile = new databricks.InstanceProfile("instance_profile", {instanceProfileArn: "my_instance_profile_arn"});
const myUser = new databricks.User("my_user", {userName: "me@example.com"});
const myUserRole = new databricks.UserRole("my_user_role", {
userId: myUser.id,
role: instanceProfile.id,
});
import pulumi
import pulumi_databricks as databricks
instance_profile = databricks.InstanceProfile("instance_profile", instance_profile_arn="my_instance_profile_arn")
my_user = databricks.User("my_user", user_name="me@example.com")
my_user_role = databricks.UserRole("my_user_role",
user_id=my_user.id,
role=instance_profile.id)
package main
import (
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
instanceProfile, err := databricks.NewInstanceProfile(ctx, "instance_profile", &databricks.InstanceProfileArgs{
InstanceProfileArn: pulumi.String("my_instance_profile_arn"),
})
if err != nil {
return err
}
myUser, err := databricks.NewUser(ctx, "my_user", &databricks.UserArgs{
UserName: pulumi.String("me@example.com"),
})
if err != nil {
return err
}
_, err = databricks.NewUserRole(ctx, "my_user_role", &databricks.UserRoleArgs{
UserId: myUser.ID(),
Role: instanceProfile.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() =>
{
var instanceProfile = new Databricks.InstanceProfile("instance_profile", new()
{
InstanceProfileArn = "my_instance_profile_arn",
});
var myUser = new Databricks.User("my_user", new()
{
UserName = "me@example.com",
});
var myUserRole = new Databricks.UserRole("my_user_role", new()
{
UserId = myUser.Id,
Role = instanceProfile.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.InstanceProfile;
import com.pulumi.databricks.InstanceProfileArgs;
import com.pulumi.databricks.User;
import com.pulumi.databricks.UserArgs;
import com.pulumi.databricks.UserRole;
import com.pulumi.databricks.UserRoleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instanceProfile = new InstanceProfile("instanceProfile", InstanceProfileArgs.builder()
.instanceProfileArn("my_instance_profile_arn")
.build());
var myUser = new User("myUser", UserArgs.builder()
.userName("me@example.com")
.build());
var myUserRole = new UserRole("myUserRole", UserRoleArgs.builder()
.userId(myUser.id())
.role(instanceProfile.id())
.build());
}
}
resources:
instanceProfile:
type: databricks:InstanceProfile
name: instance_profile
properties:
instanceProfileArn: my_instance_profile_arn
myUser:
type: databricks:User
name: my_user
properties:
userName: me@example.com
myUserRole:
type: databricks:UserRole
name: my_user_role
properties:
userId: ${myUser.id}
role: ${instanceProfile.id}
Adding user as administrator to Databricks Account
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
const myUser = new databricks.User("my_user", {userName: "me@example.com"});
const myUserAccountAdmin = new databricks.UserRole("my_user_account_admin", {
userId: myUser.id,
role: "account_admin",
});
import pulumi
import pulumi_databricks as databricks
my_user = databricks.User("my_user", user_name="me@example.com")
my_user_account_admin = databricks.UserRole("my_user_account_admin",
user_id=my_user.id,
role="account_admin")
package main
import (
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myUser, err := databricks.NewUser(ctx, "my_user", &databricks.UserArgs{
UserName: pulumi.String("me@example.com"),
})
if err != nil {
return err
}
_, err = databricks.NewUserRole(ctx, "my_user_account_admin", &databricks.UserRoleArgs{
UserId: myUser.ID(),
Role: pulumi.String("account_admin"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() =>
{
var myUser = new Databricks.User("my_user", new()
{
UserName = "me@example.com",
});
var myUserAccountAdmin = new Databricks.UserRole("my_user_account_admin", new()
{
UserId = myUser.Id,
Role = "account_admin",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.User;
import com.pulumi.databricks.UserArgs;
import com.pulumi.databricks.UserRole;
import com.pulumi.databricks.UserRoleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myUser = new User("myUser", UserArgs.builder()
.userName("me@example.com")
.build());
var myUserAccountAdmin = new UserRole("myUserAccountAdmin", UserRoleArgs.builder()
.userId(myUser.id())
.role("account_admin")
.build());
}
}
resources:
myUser:
type: databricks:User
name: my_user
properties:
userName: me@example.com
myUserAccountAdmin:
type: databricks:UserRole
name: my_user_account_admin
properties:
userId: ${myUser.id}
role: account_admin
Related Resources
The following resources are often used in the same context:
- End to end workspace management guide.
- 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 to manage users, that could be added to databricks.Group within the workspace.
- databricks.User data to retrieve information about databricks_user.
Create UserRole Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UserRole(name: string, args: UserRoleArgs, opts?: CustomResourceOptions);
@overload
def UserRole(resource_name: str,
args: UserRoleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UserRole(resource_name: str,
opts: Optional[ResourceOptions] = None,
role: Optional[str] = None,
user_id: Optional[str] = None)
func NewUserRole(ctx *Context, name string, args UserRoleArgs, opts ...ResourceOption) (*UserRole, error)
public UserRole(string name, UserRoleArgs args, CustomResourceOptions? opts = null)
public UserRole(String name, UserRoleArgs args)
public UserRole(String name, UserRoleArgs args, CustomResourceOptions options)
type: databricks:UserRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args UserRoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args UserRoleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UserRoleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserRoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserRoleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var userRoleResource = new Databricks.UserRole("userRoleResource", new()
{
Role = "string",
UserId = "string",
});
example, err := databricks.NewUserRole(ctx, "userRoleResource", &databricks.UserRoleArgs{
Role: pulumi.String("string"),
UserId: pulumi.String("string"),
})
var userRoleResource = new UserRole("userRoleResource", UserRoleArgs.builder()
.role("string")
.userId("string")
.build());
user_role_resource = databricks.UserRole("userRoleResource",
role="string",
user_id="string")
const userRoleResource = new databricks.UserRole("userRoleResource", {
role: "string",
userId: "string",
});
type: databricks:UserRole
properties:
role: string
userId: string
UserRole Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The UserRole resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the UserRole resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing UserRole Resource
Get an existing UserRole resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: UserRoleState, opts?: CustomResourceOptions): UserRole
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
role: Optional[str] = None,
user_id: Optional[str] = None) -> UserRole
func GetUserRole(ctx *Context, name string, id IDInput, state *UserRoleState, opts ...ResourceOption) (*UserRole, error)
public static UserRole Get(string name, Input<string> id, UserRoleState? state, CustomResourceOptions? opts = null)
public static UserRole get(String name, Output<String> id, UserRoleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
Import
!> Importing this resource is not currently supported.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
databricks
Terraform Provider.