Open fjakobs opened 2 years ago
When I move the library out into a library resource then it works just fine:
resource "databricks_library" "wheel" {
cluster_id = databricks_cluster.this.cluster_id
whl = databricks_dbfs_file.wheel.dbfs_path
}
I think this is notable when creating a cluster via a databricks_job
as (as far as I can tell?) we can't use the databricks_library
resource there so applies fail.
I spent some time on this issue and found the following:
The library schema is a set type. When TF performs comparison of a resource to determine 1) if it has changed during planning, or 2) if it is consistent with planning during apply, it performs a set comparison on this type. When attaching a debugger to Terraform itself (not the provider) when reproducing this issue, I see that during (1) the set comparison function looks at values where optional strings are nil, while during (2) the set comparison function attempts to compare nil to an empty string, and fails. That's why the returned error says "does not correlate with any element in actual". Because of the nil vs empty string comparison, the object equivalence function returns false, and TF decides that the value to be applied is inconsistent with the value observed during planning.
I am facing the same issue with provider version 1.40.0. Unfortunately we are not able to use databricks_library as a work around because are using a job cluster. Any other approach worked for library deployment?
I have a wheel library configured and after updating the wheel code I'm no longer able to apply terraform changes. I keep getting:
Configuration
Expected Behavior
The library should be replaced
Actual Behavior
Fails with the error shown above
Steps to Reproduce
terraform apply
python ./setup.py bdist_wheel
terraform apply
terraform apply
passesTerraform and provider versions
Debug Output
https://gist.github.com/fjakobs/17cdc8442efbf5b7b47f1736e34deb71