-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for Unity Catalog databricks_catalog_workspace_binding
resource
#2364
Conversation
@nkvuong It's far from done but I though I'd open a draft PR so you can see the direction I'm going in. The main challenge so far is that the terraform schema doesn't match the API schema so I'm trying to figure out the best way to work around that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave a couple of comments on how to proceed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- use BindResource
- add acceptance test
- add documentation
Thank you both for the feedback! I've addressed most of it but I'm running into issues here with the pair id. The workspace id is defined as |
@ehab-eb use |
7282154
to
a78168e
Compare
acceptance test is failing with |
Once your PR is merged should the isolation level be implicitly updated in this resource or should it rely on the catalog resource setting the correct isolation mode? |
this may cause drifts in the catalog resource, which is not ideal
this is better, but then require the catalog to be created in Terraform, but I would prefer this approach. maybe worth checking that the catalog has the correct isolation mode during creation? |
Or just that the user has toggled any of the workspaces attached to this catalog using the UI.
I was thinking the same thing but I'm wondering if it makes more sense to just let the API fail naturally? Either way I'll add a note in the docs about the isolation mode. |
76a5b6d
to
e576830
Compare
so we have a slight problem - creating catalog with I'm going to check with our engineering team on how they expect it to work |
That's kind of strange since I'm not specifying an isolation mode for the prod catalog. My understanding is that it should default to OPEN and be accessible from all workspaces. |
@ehab-eb sorry, copied the wrong error message, as I was trying to test locally as well. I checked in the UI, and the API actually returns a 403 as well and the UI just hides the error. However, workspace binding APIs and patching the catalog still works, which means we need to handle this 403 somehow |
@nkvuong so you're saying that when a catalog is created in isolated mode and then we try to attach it to the current workspace the bindings API returns a 403 AND succeeds in making the binding? |
@ehab-eb this is the behaviour I am seeing:
|
@nkvuong Ah okay that makes sense. The options I see for this are either co-locating the the bindings and isolation mode calls by combining the resources or attaching the current workspace by default when a catalog is set to ISOLATED. What do you think? |
@ehab-eb we won't have an ideal solution either way - I prefer the 2nd option (and we add it to the doc). A 3rd option is to handle the 403 response in the |
Yep I agree. Option 2 makes the most sense. Will make the changes |
@nkvuong I'm scratching my head a little bit trying to find a way to get the current workspace id. I can find the host url but not sure how to connect that to an actual id. Any tips on where to look? I considered implicitly calling |
within go sdk, there is this method that should return the |
@nkvuong Thanks! That did it :) |
@nkvuong I've made a change to how I identify the current metastore. I believe it's more or less the same call underneath but I'm not sure what the root cause was for the error you got so it might be worth running the acceptance tests again? |
databricks_catalog_workspace_binding
resource
Co-authored-by: vuong-nguyen <[email protected]>
56c3c9f
to
9b2c8d1
Compare
@ehab-eb acceptance tests are still failing with
|
@@ -75,6 +76,26 @@ func ResourceCatalog() *schema.Resource { | |||
return err | |||
} | |||
|
|||
if d.Get("isolation_mode") != "ISOLATED" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to use stronger typed APIs
if d.Get("isolation_mode") != "ISOLATED" { | |
if ci.IsolationMode != "ISOLATED" { |
Thanks for implementing this resource. @nfx when do you plan to release this? |
@nfx Thanks this is awesome work! Would like to know about the release schedule too 🙏 |
Changes
Closes #2312
Tests
make test
run locallydocs/
folderinternal/acceptance