Skip to content

Commit

Permalink
fix: Fix default secondary roles option import (#3041)
Browse files Browse the repository at this point in the history
Fix issue with default secondary roles option import
  • Loading branch information
sfc-gh-asawicki authored Sep 4, 2024
1 parent cd1636c commit 0a3ce34
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/resources/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,19 @@ func ImportUser(ctx context.Context, d *schema.ResourceData, meta any) ([]*schem
return nil, err
}

u, err := client.Users.ShowByID(ctx, id)
if err != nil {
return nil, err
}

err = errors.Join(
d.Set("name", id.Name()),
setFromStringPropertyIfNotEmpty(d, "login_name", userDetails.LoginName),
setFromStringPropertyIfNotEmpty(d, "display_name", userDetails.DisplayName),
setFromStringPropertyIfNotEmpty(d, "default_namespace", userDetails.DefaultNamespace),
setBooleanStringFromBoolProperty(d, "must_change_password", userDetails.MustChangePassword),
setBooleanStringFromBoolProperty(d, "disabled", userDetails.Disabled),
d.Set("default_secondary_roles_option", u.GetSecondaryRolesOption()),
// all others are set in read
)
if err != nil {
Expand Down

0 comments on commit 0a3ce34

Please sign in to comment.