terraform-provider-databricks
terraform-provider-databricks copied to clipboard
[ISSUE] Issue with `databricks_user` resource
Configuration
terraform {
required_version = ">= 1.0"
required_providers {
databricks = {
source = "databricks/databricks"
version = "1.33.0"
}
}
}
provider "databricks" {
host = "https://accounts.azuredatabricks.net"
account_id = "zzz-zzz-zzz"
auth_type = "azure-cli"
}
#
# Creation of this user succeeds, force flag is doing its thing
#
resource "databricks_user" "marco" {
user_name = "xxxxxxx"
display_name = "XXXXXX"
active = true
disable_as_user_deletion = false
external_id = "xxx-xxx-xxx"
force = true
}
#
# This one fails with: Error: cannot create user: User with email yyyyyy already exists in this account
#
resource "databricks_user" "dimitry" {
user_name = "yyyyyy"
display_name = "YYYYYY"
active = true
disable_as_user_deletion = false
external_id = "yyy-yyy-yyy"
force = true
}
Expected Behavior
Both are users that already exist in the databricks acount, but as for both the force flag is set, I would expect them to be created (in state) successfully.
Actual Behavior
One is created successfully, the other fails with the error: Error: cannot create user: User with email yyyyyy already exists in this account
Steps to Reproduce
terraform apply
Terraform and provider versions
Terraform v1.3.1 on darwin_arm64
- provider registry.terraform.io/databricks/databricks v1.33.0
Your version of Terraform is out of date! The latest version is 1.6.6. You can update by downloading from https://www.terraform.io/downloads.html
Is it a regression?
It used to work (and actually in the example it is working for one, but not the other), but it stopped working without a change in the provider. So it seems more backend/api related.
Debug Output
https://gist.github.com/gercograndia/956271aed7f75dd8aa922b104812fcf1
Important Factoids
Initially the now failing user also succeeded, but I started toggling the disable_as_user_deletion flag (to make the things the same as what we have in the production pipeline) and then it started to fail as well.
Initially I thought then that it was related to that flag, but setting it back to its original state still kept the user failing. So something changed, and from that point onwards things never recovered.
Would you like to implement a fix?
I can't unfortunately.
~@gercograndia can you please collect debug logs as described in the first section of troubleshooting guide~ I see it now - link was pasted incorrectly
@gercograndia are the any special characters in the email of this user? Can you send me actual email to alexey.ott at databricks dot com ?
you've got mail.
@gercograndia it should be fixed by this: https://github.com/databricks/terraform-provider-databricks/pull/3295
Thanks @alexott .
Is it released already? Using the latest (v1.37.1) I am still encountering the same issue.
However, I can confirm that the problematic user account in my set of two is indeed an upper case ID, and when I lower it, it simply works. Meaning a simple workaround is available already.
No, not released yet
Check. Thanks for your help guys!
Fixed by #3295