1. Packages
  2. Packages
  3. Databricks Provider
  4. API Docs
  5. MetastoreAssignment
Viewing docs for Databricks v1.91.1
published on Friday, May 1, 2026 by Pulumi
databricks logo
Viewing docs for Databricks v1.91.1
published on Friday, May 1, 2026 by Pulumi

    This resource can be used with an account or workspace-level provider.

    A single databricks.Metastore can be shared across Databricks workspaces, and each linked workspace has a consistent view of the data and a single set of access policies. You can only create a single metastore for each region in which your organization operates.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const _this = new databricks.Metastore("this", {
        name: "primary",
        storageRoot: `s3://${metastore.id}/metastore`,
        owner: "uc admins",
        region: "us-east-1",
        forceDestroy: true,
    });
    const thisMetastoreAssignment = new databricks.MetastoreAssignment("this", {
        metastoreId: _this.id,
        workspaceId: workspaceId,
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    this = databricks.Metastore("this",
        name="primary",
        storage_root=f"s3://{metastore['id']}/metastore",
        owner="uc admins",
        region="us-east-1",
        force_destroy=True)
    this_metastore_assignment = databricks.MetastoreAssignment("this",
        metastore_id=this.id,
        workspace_id=workspace_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 {
    		this, err := databricks.NewMetastore(ctx, "this", &databricks.MetastoreArgs{
    			Name:         pulumi.String("primary"),
    			StorageRoot:  pulumi.Sprintf("s3://%v/metastore", metastore.Id),
    			Owner:        pulumi.String("uc admins"),
    			Region:       pulumi.String("us-east-1"),
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewMetastoreAssignment(ctx, "this", &databricks.MetastoreAssignmentArgs{
    			MetastoreId: this.ID(),
    			WorkspaceId: pulumi.Any(workspaceId),
    		})
    		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 @this = new Databricks.Index.Metastore("this", new()
        {
            Name = "primary",
            StorageRoot = $"s3://{metastore.Id}/metastore",
            Owner = "uc admins",
            Region = "us-east-1",
            ForceDestroy = true,
        });
    
        var thisMetastoreAssignment = new Databricks.Index.MetastoreAssignment("this", new()
        {
            MetastoreId = @this.Id,
            WorkspaceId = workspaceId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.Metastore;
    import com.pulumi.databricks.MetastoreArgs;
    import com.pulumi.databricks.MetastoreAssignment;
    import com.pulumi.databricks.MetastoreAssignmentArgs;
    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 this_ = new Metastore("this", MetastoreArgs.builder()
                .name("primary")
                .storageRoot(String.format("s3://%s/metastore", metastore.id()))
                .owner("uc admins")
                .region("us-east-1")
                .forceDestroy(true)
                .build());
    
            var thisMetastoreAssignment = new MetastoreAssignment("thisMetastoreAssignment", MetastoreAssignmentArgs.builder()
                .metastoreId(this_.id())
                .workspaceId(workspaceId)
                .build());
    
        }
    }
    
    resources:
      this:
        type: databricks:Metastore
        properties:
          name: primary
          storageRoot: s3://${metastore.id}/metastore
          owner: uc admins
          region: us-east-1
          forceDestroy: true
      thisMetastoreAssignment:
        type: databricks:MetastoreAssignment
        name: this
        properties:
          metastoreId: ${this.id}
          workspaceId: ${workspaceId}
    

    Create MetastoreAssignment Resource

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

    Constructor syntax

    new MetastoreAssignment(name: string, args: MetastoreAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def MetastoreAssignment(resource_name: str,
                            args: MetastoreAssignmentArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def MetastoreAssignment(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            metastore_id: Optional[str] = None,
                            workspace_id: Optional[str] = None,
                            api: Optional[str] = None,
                            default_catalog_name: Optional[str] = None,
                            provider_config: Optional[MetastoreAssignmentProviderConfigArgs] = None)
    func NewMetastoreAssignment(ctx *Context, name string, args MetastoreAssignmentArgs, opts ...ResourceOption) (*MetastoreAssignment, error)
    public MetastoreAssignment(string name, MetastoreAssignmentArgs args, CustomResourceOptions? opts = null)
    public MetastoreAssignment(String name, MetastoreAssignmentArgs args)
    public MetastoreAssignment(String name, MetastoreAssignmentArgs args, CustomResourceOptions options)
    
    type: databricks:MetastoreAssignment
    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 MetastoreAssignmentArgs
    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 MetastoreAssignmentArgs
    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 MetastoreAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MetastoreAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MetastoreAssignmentArgs
    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 metastoreAssignmentResource = new Databricks.MetastoreAssignment("metastoreAssignmentResource", new()
    {
        MetastoreId = "string",
        WorkspaceId = "string",
        Api = "string",
        ProviderConfig = new Databricks.Inputs.MetastoreAssignmentProviderConfigArgs
        {
            WorkspaceId = "string",
        },
    });
    
    example, err := databricks.NewMetastoreAssignment(ctx, "metastoreAssignmentResource", &databricks.MetastoreAssignmentArgs{
    	MetastoreId: pulumi.String("string"),
    	WorkspaceId: pulumi.String("string"),
    	Api:         pulumi.String("string"),
    	ProviderConfig: &databricks.MetastoreAssignmentProviderConfigArgs{
    		WorkspaceId: pulumi.String("string"),
    	},
    })
    
    var metastoreAssignmentResource = new MetastoreAssignment("metastoreAssignmentResource", MetastoreAssignmentArgs.builder()
        .metastoreId("string")
        .workspaceId("string")
        .api("string")
        .providerConfig(MetastoreAssignmentProviderConfigArgs.builder()
            .workspaceId("string")
            .build())
        .build());
    
    metastore_assignment_resource = databricks.MetastoreAssignment("metastoreAssignmentResource",
        metastore_id="string",
        workspace_id="string",
        api="string",
        provider_config={
            "workspace_id": "string",
        })
    
    const metastoreAssignmentResource = new databricks.MetastoreAssignment("metastoreAssignmentResource", {
        metastoreId: "string",
        workspaceId: "string",
        api: "string",
        providerConfig: {
            workspaceId: "string",
        },
    });
    
    type: databricks:MetastoreAssignment
    properties:
        api: string
        metastoreId: string
        providerConfig:
            workspaceId: string
        workspaceId: string
    

    MetastoreAssignment 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 MetastoreAssignment resource accepts the following input properties:

    MetastoreId string
    Unique identifier of the parent Metastore
    WorkspaceId string
    id of the workspace for the assignment
    Api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    DefaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    ProviderConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    MetastoreId string
    Unique identifier of the parent Metastore
    WorkspaceId string
    id of the workspace for the assignment
    Api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    DefaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    ProviderConfig MetastoreAssignmentProviderConfigArgs
    Configure the provider for management through account provider. This block consists of the following fields:
    metastoreId String
    Unique identifier of the parent Metastore
    workspaceId String
    id of the workspace for the assignment
    api String
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName String
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    providerConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    metastoreId string
    Unique identifier of the parent Metastore
    workspaceId string
    id of the workspace for the assignment
    api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    providerConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    metastore_id str
    Unique identifier of the parent Metastore
    workspace_id str
    id of the workspace for the assignment
    api str
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    default_catalog_name str
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    provider_config MetastoreAssignmentProviderConfigArgs
    Configure the provider for management through account provider. This block consists of the following fields:
    metastoreId String
    Unique identifier of the parent Metastore
    workspaceId String
    id of the workspace for the assignment
    api String
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName String
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    providerConfig Property Map
    Configure the provider for management through account provider. This block consists of the following fields:

    Outputs

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

    Get an existing MetastoreAssignment 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?: MetastoreAssignmentState, opts?: CustomResourceOptions): MetastoreAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api: Optional[str] = None,
            default_catalog_name: Optional[str] = None,
            metastore_id: Optional[str] = None,
            provider_config: Optional[MetastoreAssignmentProviderConfigArgs] = None,
            workspace_id: Optional[str] = None) -> MetastoreAssignment
    func GetMetastoreAssignment(ctx *Context, name string, id IDInput, state *MetastoreAssignmentState, opts ...ResourceOption) (*MetastoreAssignment, error)
    public static MetastoreAssignment Get(string name, Input<string> id, MetastoreAssignmentState? state, CustomResourceOptions? opts = null)
    public static MetastoreAssignment get(String name, Output<String> id, MetastoreAssignmentState state, CustomResourceOptions options)
    resources:  _:    type: databricks:MetastoreAssignment    get:      id: ${id}
    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:
    Api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    DefaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    MetastoreId string
    Unique identifier of the parent Metastore
    ProviderConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    WorkspaceId string
    id of the workspace for the assignment
    Api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    DefaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    MetastoreId string
    Unique identifier of the parent Metastore
    ProviderConfig MetastoreAssignmentProviderConfigArgs
    Configure the provider for management through account provider. This block consists of the following fields:
    WorkspaceId string
    id of the workspace for the assignment
    api String
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName String
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    metastoreId String
    Unique identifier of the parent Metastore
    providerConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    workspaceId String
    id of the workspace for the assignment
    api string
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName string
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    metastoreId string
    Unique identifier of the parent Metastore
    providerConfig MetastoreAssignmentProviderConfig
    Configure the provider for management through account provider. This block consists of the following fields:
    workspaceId string
    id of the workspace for the assignment
    api str
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    default_catalog_name str
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    metastore_id str
    Unique identifier of the parent Metastore
    provider_config MetastoreAssignmentProviderConfigArgs
    Configure the provider for management through account provider. This block consists of the following fields:
    workspace_id str
    id of the workspace for the assignment
    api String
    Specifies whether to use account-level or workspace-level API. Valid values are account and workspace. When not set, the API level is inferred from the provider host.
    defaultCatalogName String
    Default catalog used for this assignment. Please use databricks.DefaultNamespaceSetting instead.

    Deprecated: Use databricks.DefaultNamespaceSetting resource instead

    metastoreId String
    Unique identifier of the parent Metastore
    providerConfig Property Map
    Configure the provider for management through account provider. This block consists of the following fields:
    workspaceId String
    id of the workspace for the assignment

    Supporting Types

    MetastoreAssignmentProviderConfig, MetastoreAssignmentProviderConfigArgs

    WorkspaceId string
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
    WorkspaceId string
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
    workspaceId String
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
    workspaceId string
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
    workspace_id str
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
    workspaceId String
    Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Viewing docs for Databricks v1.91.1
    published on Friday, May 1, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.