terraformdatabricksazure-databricksterraform-provider-databricks

Placing repository inside subdirectory in Databricks Repos with Terraform


With Terraform I am trying to create a directory inside Repos, with a repository.

resource "databricks_directory" "test_directory" {
    path    = "/Repos/test123"
}

resource "databricks_repo" "test_repo" {
    url     = "https://somegiturl.com"

    path    = databricks_directory.test_directory.path
    # Other variations tried:
    #2 path    = "/Repos/test123"
    #3 path    = "${databricks_directory.test_directory.path}/"
    #4 path    = "/test123"

    branch  = "main"
}

The first resource successfully creates the test123 folder inside Repos.

Repos Directory

The second resource states for path option 1, 2 and 3:

Error: Invalid repo path specified

Option 4:

Error: Repos can only be created in the /Repos folder

Apparently I am missing something... How can I successfully place the repository inside the test123 folder?


Solution

  • Okay, so apparently you need to put the repo as a folder inside the directory.

    So it should be:

    path    = "/Repos/test123/MyRepo"
    

    or

    path    = "${databricks_directory.test_directory.path}/MyRepo"