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 issue where null values are incorrectly coerced to empty lists #284

Merged
merged 1 commit into from
Mar 17, 2025
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: 3 additions & 3 deletions vercel/resource_shared_environment_variable_project_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type SharedEnvironmentVariableProjectLink struct {
TeamID types.String `tfsdk:"team_id"`
}

func (e *SharedEnvironmentVariableProjectLink) toUpdateSharedEnvironmentVariableRequest(ctx context.Context, link bool) (req client.UpdateSharedEnvironmentVariableRequest, ok bool) {
func (e *SharedEnvironmentVariableProjectLink) toUpdateSharedEnvironmentVariableRequest(link bool) (req client.UpdateSharedEnvironmentVariableRequest, ok bool) {
upd := client.UpdateSharedEnvironmentVariableRequestProjectIDUpdates{}

if link {
Expand All @@ -106,7 +106,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Create(ctx context.Contex
return
}

request, ok := plan.toUpdateSharedEnvironmentVariableRequest(ctx, true)
request, ok := plan.toUpdateSharedEnvironmentVariableRequest(true)
if !ok {
return
}
Expand Down Expand Up @@ -194,7 +194,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Delete(ctx context.Contex
return
}

request, ok := plan.toUpdateSharedEnvironmentVariableRequest(ctx, false)
request, ok := plan.toUpdateSharedEnvironmentVariableRequest(false)
if !ok {
return
}
Expand Down
15 changes: 11 additions & 4 deletions vercel/resource_team_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,18 @@ func convertResponseToTeamMember(response client.TeamMember, plan TeamMember) Te
))
}
projects := types.SetValueMust(projectsElemType, projectsAttrs)
if len(projectsAttrs) == 0 {
projects = types.SetNull(projectsElemType)
}

var ags []attr.Value
for _, ag := range response.AccessGroups {
ags = append(ags, types.StringValue(ag.ID))
}
accessGroups := types.SetValueMust(types.StringType, ags)
if len(ags) == 0 {
accessGroups = types.SetNull(types.StringType)
}

teamMember := TeamMember{
UserID: types.StringValue(response.UserID),
Expand Down Expand Up @@ -448,10 +454,11 @@ func (r *teamMemberResource) Read(ctx context.Context, req resource.ReadRequest,
TeamID: state.TeamID.ValueString(),
UserID: state.UserID.ValueString(),
})
tflog.Error(ctx, "Read team member", map[string]any{
"team_id": state.TeamID.ValueString(),
"user_id": state.UserID.ValueString(),
"err": err,
tflog.Info(ctx, "Read team member", map[string]any{
"team_id": state.TeamID.ValueString(),
"user_id": state.UserID.ValueString(),
"err": err,
"response": response,
})
if client.NotFound(err) {
resp.State.RemoveResource(ctx)
Expand Down