databricks_file Resource

This resource allows uploading and downloading files in databricks_volume.

Notes:

Example Usage

In order to manage a file on Unity Catalog Volumes with Terraform, you must specify the source attribute containing the full path to the file on the local filesystem.

resource "databricks_catalog" "sandbox" {
  metastore_id = databricks_metastore.this.id
  name         = "sandbox"
  comment      = "this catalog is managed by terraform"
  properties = {
    purpose = "testing"
  }
}

resource "databricks_schema" "things" {
  catalog_name = databricks_catalog.sandbox.name
  name         = "things"
  comment      = "this schema is managed by terraform"
  properties = {
    kind = "various"
  }
}

resource "databricks_volume" "this" {
  name         = "quickstart_volume"
  catalog_name = databricks_catalog.sandbox.name
  schema_name  = databricks_schema.things.name
  volume_type  = "MANAGED"
  comment      = "this volume is managed by terraform"
}

resource "databricks_file" "this" {
  source = "/full/path/on/local/system"
  path   = "${databricks_volume.this.volume_path}/fileName"
}

You can also inline sources through content_base64 attribute.

resource "databricks_file" "init_script" {
  content_base64 = base64encode(<<-EOT
    #!/bin/bash
    echo "Hello World"
    EOT
  )
  path = "${databricks_volume.this.volume_path}/fileName"
}

Argument Reference

The following arguments are supported:

Attribute Reference

In addition to all arguments above, the following attributes are exported:

Import

The resource databricks_file can be imported using the path of the file:

terraform import databricks_file.this <path>

The following resources are often used in the same context: