databricks logo
Databricks v1.14.0, May 23 23

databricks.ServicePrincipalRole

Explore with Pulumi AI

This resource allows you to attach a role or databricks.InstanceProfile (AWS) to a databricks_service_principal.

The following resources are often used in the same context:

  • End to end workspace management guide.
  • databricks.UserRole to attach role or databricks.InstanceProfile (AWS) to databricks_user.
  • 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.

Example Usage

Granting a service principal access to an instance profile

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;

return await Deployment.RunAsync(() => 
{
    var instanceProfile = new Databricks.InstanceProfile("instanceProfile", new()
    {
        InstanceProfileArn = "my_instance_profile_arn",
    });

    var @this = new Databricks.ServicePrincipal("this", new()
    {
        DisplayName = "My Service Principal",
    });

    var myServicePrincipalInstanceProfile = new Databricks.ServicePrincipalRole("myServicePrincipalInstanceProfile", new()
    {
        ServicePrincipalId = @this.Id,
        Role = instanceProfile.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, "instanceProfile", &databricks.InstanceProfileArgs{
			InstanceProfileArn: pulumi.String("my_instance_profile_arn"),
		})
		if err != nil {
			return err
		}
		this, err := databricks.NewServicePrincipal(ctx, "this", &databricks.ServicePrincipalArgs{
			DisplayName: pulumi.String("My Service Principal"),
		})
		if err != nil {
			return err
		}
		_, err = databricks.NewServicePrincipalRole(ctx, "myServicePrincipalInstanceProfile", &databricks.ServicePrincipalRoleArgs{
			ServicePrincipalId: this.ID(),
			Role:               instanceProfile.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.ServicePrincipal;
import com.pulumi.databricks.ServicePrincipalArgs;
import com.pulumi.databricks.ServicePrincipalRole;
import com.pulumi.databricks.ServicePrincipalRoleArgs;
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 this_ = new ServicePrincipal("this", ServicePrincipalArgs.builder()        
            .displayName("My Service Principal")
            .build());

        var myServicePrincipalInstanceProfile = new ServicePrincipalRole("myServicePrincipalInstanceProfile", ServicePrincipalRoleArgs.builder()        
            .servicePrincipalId(this_.id())
            .role(instanceProfile.id())
            .build());

    }
}
import pulumi
import pulumi_databricks as databricks

instance_profile = databricks.InstanceProfile("instanceProfile", instance_profile_arn="my_instance_profile_arn")
this = databricks.ServicePrincipal("this", display_name="My Service Principal")
my_service_principal_instance_profile = databricks.ServicePrincipalRole("myServicePrincipalInstanceProfile",
    service_principal_id=this.id,
    role=instance_profile.id)
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const instanceProfile = new databricks.InstanceProfile("instanceProfile", {instanceProfileArn: "my_instance_profile_arn"});
const _this = new databricks.ServicePrincipal("this", {displayName: "My Service Principal"});
const myServicePrincipalInstanceProfile = new databricks.ServicePrincipalRole("myServicePrincipalInstanceProfile", {
    servicePrincipalId: _this.id,
    role: instanceProfile.id,
});
resources:
  instanceProfile:
    type: databricks:InstanceProfile
    properties:
      instanceProfileArn: my_instance_profile_arn
  this:
    type: databricks:ServicePrincipal
    properties:
      displayName: My Service Principal
  myServicePrincipalInstanceProfile:
    type: databricks:ServicePrincipalRole
    properties:
      servicePrincipalId: ${this.id}
      role: ${instanceProfile.id}

Create ServicePrincipalRole Resource

new ServicePrincipalRole(name: string, args: ServicePrincipalRoleArgs, opts?: CustomResourceOptions);
@overload
def ServicePrincipalRole(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         role: Optional[str] = None,
                         service_principal_id: Optional[str] = None)
@overload
def ServicePrincipalRole(resource_name: str,
                         args: ServicePrincipalRoleArgs,
                         opts: Optional[ResourceOptions] = None)
func NewServicePrincipalRole(ctx *Context, name string, args ServicePrincipalRoleArgs, opts ...ResourceOption) (*ServicePrincipalRole, error)
public ServicePrincipalRole(string name, ServicePrincipalRoleArgs args, CustomResourceOptions? opts = null)
public ServicePrincipalRole(String name, ServicePrincipalRoleArgs args)
public ServicePrincipalRole(String name, ServicePrincipalRoleArgs args, CustomResourceOptions options)
type: databricks:ServicePrincipalRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ServicePrincipalRoleArgs
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 ServicePrincipalRoleArgs
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 ServicePrincipalRoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ServicePrincipalRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ServicePrincipalRoleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ServicePrincipalRole Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ServicePrincipalRole resource accepts the following input properties:

Role string

This is the id of the role or instance profile resource.

ServicePrincipalId string

This is the id of the service principal resource.

Role string

This is the id of the role or instance profile resource.

ServicePrincipalId string

This is the id of the service principal resource.

role String

This is the id of the role or instance profile resource.

servicePrincipalId String

This is the id of the service principal resource.

role string

This is the id of the role or instance profile resource.

servicePrincipalId string

This is the id of the service principal resource.

role str

This is the id of the role or instance profile resource.

service_principal_id str

This is the id of the service principal resource.

role String

This is the id of the role or instance profile resource.

servicePrincipalId String

This is the id of the service principal resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServicePrincipalRole 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 ServicePrincipalRole Resource

Get an existing ServicePrincipalRole 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?: ServicePrincipalRoleState, opts?: CustomResourceOptions): ServicePrincipalRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        role: Optional[str] = None,
        service_principal_id: Optional[str] = None) -> ServicePrincipalRole
func GetServicePrincipalRole(ctx *Context, name string, id IDInput, state *ServicePrincipalRoleState, opts ...ResourceOption) (*ServicePrincipalRole, error)
public static ServicePrincipalRole Get(string name, Input<string> id, ServicePrincipalRoleState? state, CustomResourceOptions? opts = null)
public static ServicePrincipalRole get(String name, Output<String> id, ServicePrincipalRoleState 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.
The following state arguments are supported:
Role string

This is the id of the role or instance profile resource.

ServicePrincipalId string

This is the id of the service principal resource.

Role string

This is the id of the role or instance profile resource.

ServicePrincipalId string

This is the id of the service principal resource.

role String

This is the id of the role or instance profile resource.

servicePrincipalId String

This is the id of the service principal resource.

role string

This is the id of the role or instance profile resource.

servicePrincipalId string

This is the id of the service principal resource.

role str

This is the id of the role or instance profile resource.

service_principal_id str

This is the id of the service principal resource.

role String

This is the id of the role or instance profile resource.

servicePrincipalId String

This is the id of the service principal resource.

Import

-> Note Importing this resource is not currently supported.

Package Details

Repository
databricks pulumi/pulumi-databricks
License
Apache-2.0
Notes

This Pulumi package is based on the databricks Terraform Provider.