terraform-provider-databricks icon indicating copy to clipboard operation
terraform-provider-databricks copied to clipboard

[ISSUE] Provider issue: Azure DevOps private repo fails with the resource databricks_repo

Open juarezr opened this issue 3 years ago • 5 comments

Hi there,

I found this error while provisioning with provider version v1.0.0:

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

databricks_directory.dir_git_repos: Creating...
databricks_directory.dir_git_repos: Creation complete after 1s [id=/Repos/DataScience/]
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for databricks_repo.git_repo_bidatabricks-ds to
│ include new values learned so far during apply, provider
│ "registry.terraform.io/databricks/databricks" produced an invalid new value
│ for .path: was cty.StringVal("/Repos/DataScience/"), but now
│ cty.StringVal("/Repos/DataScience").
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Releasing state lock. This may take a few moments...

Configuration

resource "databricks_directory" "dir_git_repos" {
  path             = "/Repos/DataScience/"
  delete_recursive = true

  lifecycle {
    create_before_destroy = true
  }
}

resource "databricks_repo" "git_repo_association" {

  git_provider = "azureDevOpsServices"
  url          = local.git_repo
  branch       = local.meurepo

  path = databricks_directory.dir_git_repos.path

  lifecycle {
    create_before_destroy = true
  }

  depends_on = [
     databricks_directory.dir_git_repos,
  ]
}

Expected Behavior

What should have happened?

  1. Add a folder in workspace
  2. associate the gitrepository inside

Actual Behavior

What actually happened?

  • Crashed

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply code above.

Terraform and provider versions

  • terraform version : v1.2.3
  • provider version: v1.0.0

Debug Output

Included above.

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Important Factoids

Are there anything atypical about your accounts that we should know? No

juarezr avatar Jun 22 '22 21:06 juarezr

hi @juarezr , are you sure that path = "/Repos/DataScience/" did work before? please try without the trailing slash in the meantime, while we add sanitization in the next release.

nfx avatar Jun 23 '22 03:06 nfx

Hi @nfx,

  • It happened in a brand new workspace.
  • It was fix by this:
    • databricks_directory
      • path = "/Repos/DataScience/"
    • databricks_repo
      • path = "/Repos/DataScience/git_reposiory_name"

juarezr avatar Jun 24 '22 06:06 juarezr

@juarezr you don't need databricks_directory - directories will be created automatically. But really, repository path always should be 3 parts -> /Repos, directory (user or custom), repo-name

alexott avatar Jun 24 '22 09:06 alexott

@alexott i think it's because of the sanitization done in the repo "create" phase. you should do it on "CustomizeDiff" phase

nfx avatar Jun 26 '22 18:06 nfx

Following up - is this issue still relevant?

nfx avatar Aug 22 '22 09:08 nfx

It should be fixed by #1702

alexott avatar Jan 05 '23 08:01 alexott