fix: try fix errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 24m13s
CI Workflow / CI run build and linting (pull_request) Successful in 26m11s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 35m13s

This commit is contained in:
Marcel S. Henselin 2026-02-16 14:39:15 +01:00
parent d5644ec27f
commit 1451273760
14 changed files with 140 additions and 40 deletions

View file

@ -11,6 +11,7 @@ import (
"strings"
"time"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/identityschema"
@ -107,6 +108,38 @@ func (r *userResource) ModifyPlan(
return
}
// TODO: verify if this is needed - START
var configRoles []string
diags := configModel.Roles.ElementsAs(ctx, &configRoles, false)
resp.Diagnostics.Append(diags...)
if diags.HasError() {
return
}
var planRoles []string
diags = planModel.Roles.ElementsAs(ctx, &planRoles, false)
resp.Diagnostics.Append(diags...)
if diags.HasError() {
return
}
slices.Sort(configRoles)
slices.Sort(planRoles)
if !slices.Equal(configRoles, planRoles) {
var roles []attr.Value
for _, role := range configRoles {
roles = append(roles, types.StringValue(string(role)))
}
rolesSet, diags := types.SetValue(types.StringType, roles)
resp.Diagnostics.Append(diags...)
if diags.HasError() {
return
}
planModel.Roles = types.List(rolesSet)
}
// TODO: verify if this is needed - END
resp.Diagnostics.Append(resp.Plan.Set(ctx, planModel)...)
if resp.Diagnostics.HasError() {
return