Skip to content
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

Fixed databricks_entitlements resource edge behaviour #2409

Merged
merged 4 commits into from
Jun 19, 2023
Merged

Conversation

nkvuong
Copy link
Contributor

@nkvuong nkvuong commented Jun 15, 2023

Changes

Fix edge cases behaviour for databricks_entitlements

  • Resource creation failed when all entitlements set to false
  • Resource did not enforce entitlements that were removed out of bound
  • Cannot delete resource if identity has no entitlement: Error: cannot delete entitlements: invalidPath No such attribute with the name : entitlements in the current resource

Close #2382

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@nkvuong nkvuong force-pushed the fix/entitlements branch from 4f6fd3e to 4d1a14e Compare June 15, 2023 09:45
@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2023

Codecov Report

Merging #2409 (facebd9) into master (fb4b25a) will increase coverage by 0.00%.
The diff coverage is 78.57%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2409   +/-   ##
=======================================
  Coverage   88.47%   88.48%           
=======================================
  Files         141      141           
  Lines       11663    11673   +10     
=======================================
+ Hits        10319    10329   +10     
  Misses        893      893           
  Partials      451      451           
Impacted Files Coverage Δ
scim/resource_entitlement.go 88.29% <62.50%> (+0.52%) ⬆️
scim/scim.go 95.00% <100.00%> (+0.88%) ⬆️

@nkvuong nkvuong force-pushed the fix/entitlements branch from 8ec7fc3 to facebd9 Compare June 15, 2023 12:03
@nkvuong
Copy link
Contributor Author

nkvuong commented Jun 15, 2023

acceptance tests passed on 3 clouds

@nkvuong nkvuong marked this pull request as ready for review June 15, 2023 13:57
@nkvuong nkvuong requested review from a team June 15, 2023 13:57
@@ -28,7 +28,7 @@ func ResourceEntitlements() *schema.Resource {
addEntitlementsToSchema(&entitlementSchema)
return common.Resource{
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
return patchEntitlements(ctx, d, c, "add")
return patchEntitlements(ctx, d, c, "replace")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern here is that we initialize entitlements with false, and when we start to replace them instead of adding, then people may lose the access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this resource is meant to enforce entitlement of said identity - the update function will enforce the entitlements anyway, so this change is to make it consistent

@nfx nfx changed the title fix databricks_entitlements resource edge behaviour Fixed databricks_entitlements resource edge behaviour Jun 19, 2023
@nfx nfx merged commit d0f193b into master Jun 19, 2023
@nfx nfx deleted the fix/entitlements branch June 19, 2023 14:19
@mgyucht mgyucht mentioned this pull request Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ISSUE] Creating databricks_entitlements fails if all entitlements are false
4 participants