MCPcopy Index your code
hub / github.com/databricks/terraform-provider-databricks

github.com/databricks/terraform-provider-databricks @v1.120.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.120.0 ↗ · + Follow
53,478 symbols 136,761 edges 975 files 28,115 documented · 53% updated 1d agov1.120.0 · 2026-07-01★ 596528 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Databricks Terraform Provider

Resources

AWS tutorial | Azure tutorial | End-to-end tutorial | Authentication | Troubleshooting Guide | Changelog | Contributing and Development Guidelines

build codecov downloads

Databricks Terraform provider works with Terraform 1.1.5 or newer. To use it please refer to instructions specified at registry page:

terraform {
  required_providers {
    databricks = {
      source = "databricks/databricks"
    }
  }
}

If you want to build it from sources, please refer to contributing guidelines.

Then create a small sample file, named main.tf with approximately following contents. Replace <your PAT token> with newly created PAT Token.

provider "databricks" {
  host  = "https://abc-defg-024.cloud.databricks.com/"
  token = "<your PAT token>"
}

data "databricks_current_user" "me" {}
data "databricks_spark_version" "latest" {}
data "databricks_node_type" "smallest" {
  local_disk = true
}

resource "databricks_notebook" "this" {
  path     = "${data.databricks_current_user.me.home}/Terraform"
  language = "PYTHON"
  content_base64 = base64encode(<<-EOT
    # created from ${abspath(path.module)}
    display(spark.range(10))
    EOT
  )
}

resource "databricks_job" "this" {
  name = "Terraform Demo (${data.databricks_current_user.me.alphanumeric})"

  new_cluster {
    num_workers   = 1
    spark_version = data.databricks_spark_version.latest.id
    node_type_id  = data.databricks_node_type.smallest.id
  }

  notebook_task {
    notebook_path = databricks_notebook.this.path
  }
}

output "notebook_url" {
  value = databricks_notebook.this.url
}

output "job_url" {
  value = databricks_job.this.url
}

Then run terraform init then terraform apply to apply the hcl code to your Databricks workspace.

OpenTofu Support

OpenTofu is an open-source fork of Terraform with the MPL 2.0 license. The Databricks Terraform provider should be compatible with OpenTofu, but this integration is not actively tested and should be considered experimental. Please raise a Github issue if you find any incompatibility.

Switching from databrickslabs to databricks namespace

To make Databricks Terraform Provider generally available, we've moved it from https://github.com/databrickslabs to https://github.com/databricks. We've worked closely with the Terraform Registry team at Hashicorp to ensure a smooth migration. Existing terraform deployments continue to work as expected without any action from your side. We ask you to replace databrickslabs/databricks with databricks/databricks in all your .tf files.

You should have .terraform.lock.hcl file in your state directory that is checked into source control. terraform init will give you the following warning.

Warning: Additional provider information from registry

The remote registry returned warnings for registry.terraform.io/databrickslabs/databricks:
- For users on Terraform 0.13 or greater, this provider has moved to databricks/databricks. Please update your source in required_providers.

After you replace databrickslabs/databricks with databricks/databricks in the required_providers block, the warning will disappear. Do a global "search and replace" in *.tf files. Alternatively you can run python3 -c "$(curl -Ls https://dbricks.co/updtfns)" from the command-line, that would do all the boring work for you.

If you didn't check-in .terraform.lock.hcl to the source code version control, you may you may see Failed to install provider error. Please follow the simple steps described in the troubleshooting guide.

Use of Terraform exporter

The exporter functionality is experimental and provided as is. It has an evolving interface, which may change or be removed in future versions of the provider.

Well-Known Types

Duration Fields

Duration fields accept Go-style duration strings. Use standard time units like s (seconds), m (minutes), h (hours).

resource "databricks_example" "this" {
  timeout_duration = "30m"   # 30 minutes
  retry_delay      = "10s"   # 10 seconds
  max_lifetime     = "24h"   # 24 hours
  short_timeout    = "500ms" # 500 milliseconds
}

Timestamp Fields

Timestamp fields require RFC3339 formatted datetime strings. Include timezone information for best results.

resource "databricks_example" "this" {
  start_time = "2023-10-15T14:30:00Z"      # UTC timezone
  end_time   = "2023-10-15T14:30:00-07:00" # Pacific timezone
  created_at = "2023-10-15T14:30:00.123Z"  # With milliseconds
}

JSON Value Fields

JSON value fields accept JSON-encoded strings. The provider will normalize and validate the JSON structure.

resource "databricks_example" "this" {
  settings = jsonencode({
    enabled = true
    options = ["option1", "option2"]
  })
}

Extension points exported contracts — how you extend this code

Mount (Interface)
Mount exposes generic url & extra config map options [11 implementers]
storage/mounts.go
ServerOption (Interface)
ServerOption is a common interface for overriding providers in GetProviderServer functino call. [6 implementers]
internal/providers/providers.go
ResourceProvider (Interface)
Generic interface for ResourceProvider. Using CustomizeSchema function to keep track of additional information on top of [18 …
common/reflect_resource.go
ResourceDataWrapper (Interface)
ResourceDataWrapper provides unified access to resource data across SDKv2 and Plugin Framework [5 implementers]
exporter/abstractions.go
CommandExecutor (Interface)
CommandExecutor creates a spark context and executes a command and then closes context [2 implementers]
common/commands.go
ACLCustomizer (FuncType)
ACLCustomizer is a function that modifies the access control list of an object before it is updated.
permissions/update/customizers.go
ACLCustomizer (FuncType)
ACLCustomizer is a function that modifies the access control list of an object after it is read.
permissions/read/customizers.go
Retrier (Interface)
Retrier decides whether to retry an operation based on the outcome of the last attempt. IsRetriable is called after ever
internal/retrier/retrier.go

Core symbols most depended-on inside this repo

SetOptional
called by 12632
internal/providers/pluginfw/tfschema/attribute_builder.go
Type
called by 4376
internal/providers/pluginfw/common/object_typable.go
SetRequired
called by 4143
internal/providers/pluginfw/tfschema/attribute_builder.go
SetComputed
called by 2297
internal/providers/pluginfw/tfschema/attribute_builder.go
Append
called by 1968
exporter/model.go
Get
called by 1385
exporter/abstractions.go
AddValidator
called by 1333
internal/providers/pluginfw/tfschema/map_attribute.go
Set
called by 778
exporter/abstractions.go

Shape

Method 43,093
Struct 6,031
Function 4,265
TypeAlias 46
Interface 28
FuncType 10
Class 5

Languages

Go100%
Python1%

Modules by API surface

internal/service/ml_tf/model.go2,515 symbols
internal/service/ml_tf/legacy_model.go2,515 symbols
internal/service/settings_tf/model.go2,033 symbols
internal/service/settings_tf/legacy_model.go2,033 symbols
internal/service/jobs_tf/model.go1,817 symbols
internal/service/jobs_tf/legacy_model.go1,817 symbols
internal/service/compute_tf/model.go1,803 symbols
internal/service/compute_tf/legacy_model.go1,803 symbols
internal/service/sql_tf/model.go1,538 symbols
internal/service/sql_tf/legacy_model.go1,538 symbols
internal/service/pipelines_tf/model.go1,058 symbols
internal/service/pipelines_tf/legacy_model.go1,058 symbols

For agents

$ claude mcp add terraform-provider-databricks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page