databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
445 stars 385 forks source link

[ISSUE] Issue with `databricks_file` resource #4039

Open sebbegg opened 1 week ago

sebbegg commented 1 week ago

Configuration

Ran the below with a fresh terraform install and version 1.52.0 of the provider.

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

provider "databricks" {}

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

resource "databricks_file" "this" {
  source = "/Users/some/path/to/mylib-2.3.0.dev31+g469a796.jar"
  path   = "/Volumes/path/on/volume/mylib-2.3.0.dev31+g469a796.jar"
}

Expected Behavior

The file should keep the + character

Actual Behavior

The terraform output claims the file has been created including the + character. Checking the content on the volume reveals that the + was replaced by a whitespace somewhere in the process.

Steps to Reproduce

  1. terraform apply

Terraform and provider versions

Is it a regression?

Debug Output

I wouldn't want to upload actual logs due to privacy... Did a grep on the filename though and noticed that the path seems to go directly into the API urls:

2024-09-23T08:34:42.204+0200 [DEBUG] provider.terraform-provider-databricks_v1.52.0: PUT /api/2.0/fs/files/Volumes/path/on/volume/mylib-2.3.0.dev31+g469a796.jar

I'd guess that filenames & paths would probably need to be url-escaped here.

Important Factoids

Would you like to implement a fix?

alexott commented 1 week ago

it's more on the Go SDK side - can you file a request in https://github.com/databricks/databricks-sdk-go?

mgyucht commented 1 week ago

FYI: we believe this is actually an issue with the Files API itself. We're following up with the team to prioritize a fix.