Skip to content

Commit dcd508e

Browse files
author
Jordan Caussat
committed
Update users datasource: add more properties to user map
1 parent 4259c40 commit dcd508e

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

gitlab/data_source_gitlab_users.go

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,54 @@ func dataSourceGitlabUsers() *schema.Resource {
118118
Type: schema.TypeBool,
119119
Computed: true,
120120
},
121+
"provider": {
122+
Type: schema.TypeString,
123+
Computed: true,
124+
},
125+
"avatar_url": {
126+
Type: schema.TypeString,
127+
Computed: true,
128+
},
129+
"bio": {
130+
Type: schema.TypeString,
131+
Computed: true,
132+
},
133+
"location": {
134+
Type: schema.TypeString,
135+
Computed: true,
136+
},
137+
"skype": {
138+
Type: schema.TypeString,
139+
Computed: true,
140+
},
141+
"linkedin": {
142+
Type: schema.TypeString,
143+
Computed: true,
144+
},
145+
"twitter": {
146+
Type: schema.TypeString,
147+
Computed: true,
148+
},
149+
"website_url": {
150+
Type: schema.TypeString,
151+
Computed: true,
152+
},
153+
"theme_id": {
154+
Type: schema.TypeInt,
155+
Computed: true,
156+
},
157+
"color_scheme_id": {
158+
Type: schema.TypeInt,
159+
Computed: true,
160+
},
161+
"last_sign_in_at": {
162+
Type: schema.TypeString,
163+
Computed: true,
164+
},
165+
"current_sign_in_at": {
166+
Type: schema.TypeString,
167+
Computed: true,
168+
},
121169
},
122170
},
123171
},
@@ -160,13 +208,29 @@ func flattenGitlabUsers(users []*gitlab.User) []interface{} {
160208
"state": user.State,
161209
"external": user.External,
162210
"extern_uid": user.ExternUID,
163-
"organization": user.Organization,
211+
"provider": user.Provider,
164212
"two_factor_enabled": user.TwoFactorEnabled,
213+
"avatar_url": user.AvatarURL,
214+
"bio": user.Bio,
215+
"location": user.Location,
216+
"skype": user.Skype,
217+
"linkedin": user.Linkedin,
218+
"twitter": user.Twitter,
219+
"website_url": user.WebsiteURL,
220+
"organization": user.Organization,
221+
"theme_id": user.ThemeID,
222+
"color_scheme_id": user.ColorSchemeID,
165223
}
166224

167225
if user.CreatedAt != nil {
168226
values["created_at"] = user.CreatedAt.String()
169227
}
228+
if user.LastSignInAt != nil {
229+
values["last_sign_in_at"] = user.LastSignInAt.String()
230+
}
231+
if user.CurrentSignInAt != nil {
232+
values["current_sign_in_at"] = user.CurrentSignInAt.String()
233+
}
170234

171235
usersList = append(usersList, values)
172236
}

website/docs/d/users.html.markdown

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,20 @@ The following attributes are exported:
6262
* `state` - Whether the user is active or blocked.
6363
* `external` - Whether the user is external.
6464
* `extern_uid` - The external UID of the user.
65+
* `provider` - The UID provider of the user.
6566
* `organization` - The organization of the user.
6667
* `two_factor_enabled` - Whether user's two factor auth is enabled.
68+
* `avatar_url` - The avatar URL of the user.
69+
* `bio` - The bio of the user.
70+
* `location` - The location of the user.
71+
* `skype` - Skype username of the user.
72+
* `linkedin` - Linkedin profile of the user.
73+
* `twitter` - Twitter username of the user.
74+
* `website_url` - User's website URL.
75+
* `theme_id` - User's theme ID.
76+
* `color_scheme_id` - User's color scheme ID.
77+
* `last_sign_in_at` - Last user's sign-in date.
78+
* `current_sign_in_at` - Current user's sign-in date.
6779

6880

6981
[users_for_admins]: https://docs.gitlab.com/ce/api/users.html#for-admins

0 commit comments

Comments
 (0)