这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix panic reading project data source #176

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

Merged
merged 1 commit into from
Apr 30, 2024
Merged
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
11 changes: 7 additions & 4 deletions vercel/data_source_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,13 @@ func convertResponseToProjectDataSource(ctx context.Context, response client.Pro
otherwise it causes issues with terraform thinking there are changes when there aren't. However,
for the data source we always want to read the value */
plan.Environment = types.SetValueMust(envVariableElemType, []attr.Value{})
plan.GitComments = types.ObjectValueMust(gitCommentsAttrTypes, map[string]attr.Value{
"on_pull_request": types.BoolValue(response.GitComments.OnPullRequest),
"on_commit": types.BoolValue(response.GitComments.OnCommit),
})
plan.GitComments = types.ObjectNull(gitCommentsAttrTypes)
if response.GitComments != nil {
plan.GitComments = types.ObjectValueMust(gitCommentsAttrTypes, map[string]attr.Value{
"on_pull_request": types.BoolValue(response.GitComments.OnPullRequest),
"on_commit": types.BoolValue(response.GitComments.OnCommit),
})
}
project, err := convertResponseToProject(ctx, response, plan, environmentVariables)
if err != nil {
return ProjectDataSource{}, err
Expand Down