This resource allows you to manage Databricks Workspace Files.
You can declare Terraform-managed workspace file by specifying source
attribute of corresponding local file.
data "databricks_current_user" "me" {
}
resource "databricks_workspace_file" "module" {
source = "${path.module}/module.py"
path = "${data.databricks_current_user.me.home}/AA/BB/CC"
}
You can also create a managed workspace file with inline sources through content_base64
attribute.
resource "databricks_workspace_file" "init_script" {
content_base64 = base64encode(<<-EOT
#!/bin/bash
echo "Hello World"
EOT
)
path = "/Shared/init-script.sh"
}
The size of a workspace file source code must not exceed a few megabytes. The following arguments are supported:
path
- (Required) The absolute path of the workspace file, beginning with "/", e.g. "/Demo".source
- Path to file on local filesystem. Conflicts with content_base64
.content_base64
- The base64-encoded file content. Conflicts with source
. Use of content_base64
is discouraged, as it's increasing memory footprint of Terraform state and should only be used in exceptional circumstances, like creating a workspace file with configuration properties for a data pipeline.In addition to all arguments above, the following attributes are exported:
id
- Path of workspace fileurl
- Routable URL of the workspace fileobject_id
- Unique identifier for a workspace fileworkspace_path
- path on Workspace File System (WSFS) in form of /Workspace
+ path
The workspace file resource can be imported using workspace file path
terraform import databricks_workspace_file.this /path/to/file
The following resources are often used in the same context: