Skip to content

[Fix] Fix empty databricks_share creation failing with 'no fields to update'#5443

Open
slimbnsalah wants to merge 1 commit intodatabricks:mainfrom
slimbnsalah:fix/empty-share-create
Open

[Fix] Fix empty databricks_share creation failing with 'no fields to update'#5443
slimbnsalah wants to merge 1 commit intodatabricks:mainfrom
slimbnsalah:fix/empty-share-create

Conversation

@slimbnsalah
Copy link
Contributor

@slimbnsalah slimbnsalah commented Mar 1, 2026

Changes

The Plugin Framework implementation of databricks_share calls w.Shares.Update() unconditionally in the Create method after w.Shares.Create(). When the resource is created with no object blocks, the UpdateShare request has an empty Updates slice, no Owner, and no Comment, causing the API to reject it with:

Error: failed to update share
UpdateShare no fields to update.

Fix

Wrapped the Update call in the Create method with a guard that skips it when there is nothing to update:

if len(shareChanges.Updates) > 0 || shareChanges.Owner != "" || !plan.Comment.IsNull() {
    // ... call Update ...
}

This mirrors the guard already present in the Update method at line 386:

if len(changes) > 0 || !plan.Comment.IsNull() {

When there's nothing to update, the share returned by Create is used directly for state.

Fixes #5442

@slimbnsalah slimbnsalah requested review from a team as code owners March 1, 2026 16:11
@slimbnsalah slimbnsalah requested review from hectorcast-db and removed request for a team March 1, 2026 16:11
@slimbnsalah slimbnsalah changed the title [Bug Fix] Fix empty databricks_share creation failing with 'no fields to update' [Fix] Fix empty databricks_share creation failing with 'no fields to update' Mar 1, 2026
Skip the UpdateShare API call in the Create method when there are no
objects, owner, or comment to update. The Create method was calling
w.Shares.Update() unconditionally after w.Shares.Create(), causing
the API to reject the request with 'no fields to update' when creating
a share with no object blocks.

This mirrors the guard already present in the Update method.

Fixes databricks#5442
@slimbnsalah slimbnsalah force-pushed the fix/empty-share-create branch from f901db5 to 7dd21e8 Compare March 1, 2026 16:40
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 5443
  • Commit SHA: 7dd21e86de49f3c0f1e07cc73b0baebf5c0ee73c

Checks will be approved automatically on success.

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 empty databricks_share fails with "UpdateShare no fields to update"

1 participant