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

fix bad resource state when reading resources #21

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions tableau/group_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ func (r *groupResource) Read(ctx context.Context, req resource.ReadRequest, resp

group, err := r.client.GetGroup(state.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(
"Error Reading Tableau Group",
"Could not read Tableau group ID "+state.ID.ValueString()+": "+err.Error(),
)
return
resp.State.RemoveResource(ctx)
}

state.ID = types.StringValue(group.ID)
Expand Down
6 changes: 1 addition & 5 deletions tableau/group_user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ func (r *groupUserResource) Read(ctx context.Context, req resource.ReadRequest,

groupUser, err := r.client.GetGroupUser(groupID, userID)
if err != nil {
resp.Diagnostics.AddError(
"Error Reading Tableau Group User",
"Could not read Tableau Group ID/ User ID "+state.GroupID.ValueString()+"/"+state.UserID.ValueString()+": "+err.Error(),
)
return
resp.State.RemoveResource(ctx)
}

combinedID := GetCombinedID(groupID, userID)
Expand Down
5 changes: 1 addition & 4 deletions tableau/project_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ func (r *projectResource) Read(ctx context.Context, req resource.ReadRequest, re

project, err := r.client.GetProject(state.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(
"Error Reading Tableau Project",
"Could not read Tableau project ID "+state.ID.ValueString()+": "+err.Error(),
)
resp.State.RemoveResource(ctx)
return
}

Expand Down
Loading