fix: try fix errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
This commit is contained in:
parent
1451273760
commit
f83fe3b30b
10 changed files with 137 additions and 243 deletions
|
|
@ -94,8 +94,8 @@ func mapFields(userResp *sqlserverflexbeta.GetUserResponse, model *resourceModel
|
|||
model.Username = types.StringPointerValue(user.Username)
|
||||
|
||||
// Map roles
|
||||
if user.Roles != nil {
|
||||
resRoles := *user.Roles
|
||||
if userResp.Roles != nil {
|
||||
resRoles := *userResp.Roles
|
||||
slices.Sort(resRoles)
|
||||
|
||||
var roles []attr.Value
|
||||
|
|
@ -103,11 +103,11 @@ func mapFields(userResp *sqlserverflexbeta.GetUserResponse, model *resourceModel
|
|||
roles = append(roles, types.StringValue(string(role)))
|
||||
}
|
||||
|
||||
rolesSet, diags := types.SetValue(types.StringType, roles)
|
||||
rolesSet, diags := types.ListValue(types.StringType, roles)
|
||||
if diags.HasError() {
|
||||
return fmt.Errorf("failed to map roles: %w", core.DiagsToError(diags))
|
||||
}
|
||||
model.Roles = types.List(rolesSet)
|
||||
model.Roles = rolesSet
|
||||
}
|
||||
|
||||
// Ensure roles is not null
|
||||
|
|
@ -153,11 +153,11 @@ func mapFieldsCreate(userResp *sqlserverflexbeta.CreateUserResponse, model *reso
|
|||
for _, role := range resRoles {
|
||||
roles = append(roles, types.StringValue(string(role)))
|
||||
}
|
||||
rolesSet, diags := types.SetValue(types.StringType, roles)
|
||||
rolesList, diags := types.ListValue(types.StringType, roles)
|
||||
if diags.HasError() {
|
||||
return fmt.Errorf("failed to map roles: %w", core.DiagsToError(diags))
|
||||
}
|
||||
model.Roles = types.List(rolesSet)
|
||||
model.Roles = rolesList
|
||||
}
|
||||
|
||||
if model.Roles.IsNull() || model.Roles.IsUnknown() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue