1. Packages
  2. Databricks Provider
  3. API Docs
  4. Directory
Databricks v1.65.0 published on Wednesday, Apr 9, 2025 by Pulumi

databricks.Directory

Explore with Pulumi AI

This resource allows you to manage directories in Databricks Workpace.

Example Usage

You can declare a Pulumi-managed directory by specifying the path attribute of the corresponding directory.

import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const myCustomDirectory = new databricks.Directory("my_custom_directory", {path: "/my_custom_directory"});
Copy
import pulumi
import pulumi_databricks as databricks

my_custom_directory = databricks.Directory("my_custom_directory", path="/my_custom_directory")
Copy
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 {
		_, err := databricks.NewDirectory(ctx, "my_custom_directory", &databricks.DirectoryArgs{
			Path: pulumi.String("/my_custom_directory"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;

return await Deployment.RunAsync(() => 
{
    var myCustomDirectory = new Databricks.Directory("my_custom_directory", new()
    {
        Path = "/my_custom_directory",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.Directory;
import com.pulumi.databricks.DirectoryArgs;
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 myCustomDirectory = new Directory("myCustomDirectory", DirectoryArgs.builder()
            .path("/my_custom_directory")
            .build());

    }
}
Copy
resources:
  myCustomDirectory:
    type: databricks:Directory
    name: my_custom_directory
    properties:
      path: /my_custom_directory
Copy

Access Control

  • databricks.Permissions can control which groups or individual users can access folders.

The following resources are often used in the same context:

  • End to end workspace management guide.
  • databricks.Notebook to manage Databricks Notebooks.
  • databricks.Notebook data to export a notebook from Databricks Workspace.
  • databricks.getNotebookPaths data to list notebooks in Databricks Workspace.
  • databricks.Repo to manage Databricks Repos.
  • databricks.getSparkVersion data to get Databricks Runtime (DBR) version that could be used for spark_version parameter in databricks.Cluster and other resources.
  • databricks.WorkspaceConf to manage workspace configuration for expert usage.

Create Directory Resource

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

Constructor syntax

new Directory(name: string, args: DirectoryArgs, opts?: CustomResourceOptions);
@overload
def Directory(resource_name: str,
              args: DirectoryArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def Directory(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              path: Optional[str] = None,
              delete_recursive: Optional[bool] = None,
              object_id: Optional[int] = None)
func NewDirectory(ctx *Context, name string, args DirectoryArgs, opts ...ResourceOption) (*Directory, error)
public Directory(string name, DirectoryArgs args, CustomResourceOptions? opts = null)
public Directory(String name, DirectoryArgs args)
public Directory(String name, DirectoryArgs args, CustomResourceOptions options)
type: databricks:Directory
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. DirectoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. DirectoryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. DirectoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DirectoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. DirectoryArgs
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 directoryResource = new Databricks.Directory("directoryResource", new()
{
    Path = "string",
    DeleteRecursive = false,
    ObjectId = 0,
});
Copy
example, err := databricks.NewDirectory(ctx, "directoryResource", &databricks.DirectoryArgs{
	Path:            pulumi.String("string"),
	DeleteRecursive: pulumi.Bool(false),
	ObjectId:        pulumi.Int(0),
})
Copy
var directoryResource = new Directory("directoryResource", DirectoryArgs.builder()
    .path("string")
    .deleteRecursive(false)
    .objectId(0)
    .build());
Copy
directory_resource = databricks.Directory("directoryResource",
    path="string",
    delete_recursive=False,
    object_id=0)
Copy
const directoryResource = new databricks.Directory("directoryResource", {
    path: "string",
    deleteRecursive: false,
    objectId: 0,
});
Copy
type: databricks:Directory
properties:
    deleteRecursive: false
    objectId: 0
    path: string
Copy

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

Path
This property is required.
Changes to this property will trigger replacement.
string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
DeleteRecursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
ObjectId int
Unique identifier for a DIRECTORY
Path
This property is required.
Changes to this property will trigger replacement.
string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
DeleteRecursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
ObjectId int
Unique identifier for a DIRECTORY
path
This property is required.
Changes to this property will trigger replacement.
String
The absolute path of the directory, beginning with "/", e.g. "/Demo".
deleteRecursive Boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId Integer
Unique identifier for a DIRECTORY
path
This property is required.
Changes to this property will trigger replacement.
string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
deleteRecursive boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId number
Unique identifier for a DIRECTORY
path
This property is required.
Changes to this property will trigger replacement.
str
The absolute path of the directory, beginning with "/", e.g. "/Demo".
delete_recursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
object_id int
Unique identifier for a DIRECTORY
path
This property is required.
Changes to this property will trigger replacement.
String
The absolute path of the directory, beginning with "/", e.g. "/Demo".
deleteRecursive Boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId Number
Unique identifier for a DIRECTORY

Outputs

All input properties are implicitly available as output properties. Additionally, the Directory resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
WorkspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
Id string
The provider-assigned unique ID for this managed resource.
WorkspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
id String
The provider-assigned unique ID for this managed resource.
workspacePath String
path on Workspace File System (WSFS) in form of /Workspace + path
id string
The provider-assigned unique ID for this managed resource.
workspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
id str
The provider-assigned unique ID for this managed resource.
workspace_path str
path on Workspace File System (WSFS) in form of /Workspace + path
id String
The provider-assigned unique ID for this managed resource.
workspacePath String
path on Workspace File System (WSFS) in form of /Workspace + path

Look up Existing Directory Resource

Get an existing Directory 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?: DirectoryState, opts?: CustomResourceOptions): Directory
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        delete_recursive: Optional[bool] = None,
        object_id: Optional[int] = None,
        path: Optional[str] = None,
        workspace_path: Optional[str] = None) -> Directory
func GetDirectory(ctx *Context, name string, id IDInput, state *DirectoryState, opts ...ResourceOption) (*Directory, error)
public static Directory Get(string name, Input<string> id, DirectoryState? state, CustomResourceOptions? opts = null)
public static Directory get(String name, Output<String> id, DirectoryState state, CustomResourceOptions options)
resources:  _:    type: databricks:Directory    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DeleteRecursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
ObjectId int
Unique identifier for a DIRECTORY
Path Changes to this property will trigger replacement. string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
WorkspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
DeleteRecursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
ObjectId int
Unique identifier for a DIRECTORY
Path Changes to this property will trigger replacement. string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
WorkspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
deleteRecursive Boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId Integer
Unique identifier for a DIRECTORY
path Changes to this property will trigger replacement. String
The absolute path of the directory, beginning with "/", e.g. "/Demo".
workspacePath String
path on Workspace File System (WSFS) in form of /Workspace + path
deleteRecursive boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId number
Unique identifier for a DIRECTORY
path Changes to this property will trigger replacement. string
The absolute path of the directory, beginning with "/", e.g. "/Demo".
workspacePath string
path on Workspace File System (WSFS) in form of /Workspace + path
delete_recursive bool
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
object_id int
Unique identifier for a DIRECTORY
path Changes to this property will trigger replacement. str
The absolute path of the directory, beginning with "/", e.g. "/Demo".
workspace_path str
path on Workspace File System (WSFS) in form of /Workspace + path
deleteRecursive Boolean
Whether or not to trigger a recursive delete of this directory and its resources when deleting this on Pulumi. Defaults to false
objectId Number
Unique identifier for a DIRECTORY
path Changes to this property will trigger replacement. String
The absolute path of the directory, beginning with "/", e.g. "/Demo".
workspacePath String
path on Workspace File System (WSFS) in form of /Workspace + path

Import

The resource directory can be imported using directory path:

bash

$ pulumi import databricks:index/directory:Directory this /path/to/directory
Copy

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.