1. Packages
  2. Databricks
  3. API Docs
  4. ServicePrincipalRole
Databricks v1.36.0 published on Friday, Apr 19, 2024 by Pulumi

databricks.ServicePrincipalRole

Explore with Pulumi AI

databricks logo
Databricks v1.36.0 published on Friday, Apr 19, 2024 by Pulumi

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

    Example Usage

    Granting a service principal access to an instance profile

    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 _this = new databricks.ServicePrincipal("this", {displayName: "My Service Principal"});
    const myServicePrincipalInstanceProfile = new databricks.ServicePrincipalRole("my_service_principal_instance_profile", {
        servicePrincipalId: _this.id,
        role: instanceProfile.id,
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    instance_profile = databricks.InstanceProfile("instance_profile", instance_profile_arn="my_instance_profile_arn")
    this = databricks.ServicePrincipal("this", display_name="My Service Principal")
    my_service_principal_instance_profile = databricks.ServicePrincipalRole("my_service_principal_instance_profile",
        service_principal_id=this.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
    		}
    		this, err := databricks.NewServicePrincipal(ctx, "this", &databricks.ServicePrincipalArgs{
    			DisplayName: pulumi.String("My Service Principal"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewServicePrincipalRole(ctx, "my_service_principal_instance_profile", &databricks.ServicePrincipalRoleArgs{
    			ServicePrincipalId: this.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 @this = new Databricks.ServicePrincipal("this", new()
        {
            DisplayName = "My Service Principal",
        });
    
        var myServicePrincipalInstanceProfile = new Databricks.ServicePrincipalRole("my_service_principal_instance_profile", new()
        {
            ServicePrincipalId = @this.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.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());
    
        }
    }
    
    resources:
      instanceProfile:
        type: databricks:InstanceProfile
        name: instance_profile
        properties:
          instanceProfileArn: my_instance_profile_arn
      this:
        type: databricks:ServicePrincipal
        properties:
          displayName: My Service Principal
      myServicePrincipalInstanceProfile:
        type: databricks:ServicePrincipalRole
        name: my_service_principal_instance_profile
        properties:
          servicePrincipalId: ${this.id}
          role: ${instanceProfile.id}
    

    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.

    Create ServicePrincipalRole Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServicePrincipalRole(name: string, args: ServicePrincipalRoleArgs, opts?: CustomResourceOptions);
    @overload
    def ServicePrincipalRole(resource_name: str,
                             args: ServicePrincipalRoleArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServicePrincipalRole(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             role: Optional[str] = None,
                             service_principal_id: Optional[str] = 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.
    
    

    Parameters

    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.

    Example

    The following reference example uses placeholder values for all input properties.

    var servicePrincipalRoleResource = new Databricks.ServicePrincipalRole("servicePrincipalRoleResource", new()
    {
        Role = "string",
        ServicePrincipalId = "string",
    });
    
    example, err := databricks.NewServicePrincipalRole(ctx, "servicePrincipalRoleResource", &databricks.ServicePrincipalRoleArgs{
    	Role:               pulumi.String("string"),
    	ServicePrincipalId: pulumi.String("string"),
    })
    
    var servicePrincipalRoleResource = new ServicePrincipalRole("servicePrincipalRoleResource", ServicePrincipalRoleArgs.builder()        
        .role("string")
        .servicePrincipalId("string")
        .build());
    
    service_principal_role_resource = databricks.ServicePrincipalRole("servicePrincipalRoleResource",
        role="string",
        service_principal_id="string")
    
    const servicePrincipalRoleResource = new databricks.ServicePrincipalRole("servicePrincipalRoleResource", {
        role: "string",
        servicePrincipalId: "string",
    });
    
    type: databricks:ServicePrincipalRole
    properties:
        role: string
        servicePrincipalId: string
    

    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.

    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.
    databricks logo
    Databricks v1.36.0 published on Friday, Apr 19, 2024 by Pulumi