Skip to content

Commit 4e5a13e

Browse files
upLukeWestonLuke Weston
andauthored
feat(MQSaaS): add 'iam_managed' and 'roles' fields to user details (#6447)
Signed-off-by: Luke Weston <[email protected]> Co-authored-by: Luke Weston <[email protected]>
1 parent 6bdea1e commit 4e5a13e

File tree

8 files changed

+54
-6
lines changed

8 files changed

+54
-6
lines changed

examples/ibm-mqcloud/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ resource "ibm_mqcloud_application" "mqcloud_application_instance" {
9696

9797
| Name | Description |
9898
|------|-------------|
99+
| iam_service_id | The IAM ID of the application. |
99100
| create_api_key_uri | The URI to create a new apikey for the application. |
100101
| href | The URL for this application. |
101102
| application_id | The ID of the application which was allocated on creation, and can be used for delete calls. |
@@ -123,6 +124,9 @@ resource "ibm_mqcloud_user" "mqcloud_user_instance" {
123124

124125
| Name | Description |
125126
|------|-------------|
127+
| iam_service_id | The IAM ID of the user. |
128+
| roles | A list of roles the user has. |
129+
| iam_managed | Indicates whether the user is managed by IAM. |
126130
| href | The URL for the user details. |
127131
| user_id | The ID of the user which was allocated on creation, and can be used for delete calls. |
128132

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/IBM/keyprotect-go-client v0.15.1
2727
github.com/IBM/logs-go-sdk v0.4.0
2828
github.com/IBM/logs-router-go-sdk v1.0.8
29-
github.com/IBM/mqcloud-go-sdk v0.3.0
29+
github.com/IBM/mqcloud-go-sdk v0.4.0
3030
github.com/IBM/networking-go-sdk v0.51.12
3131
github.com/IBM/platform-services-go-sdk v0.86.1
3232
github.com/IBM/project-go-sdk v0.3.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ github.com/IBM/logs-go-sdk v0.4.0 h1:CyUjm19EUtcJjf4mxsj6Rc7gkZDT8JEY5rLUIz8Eoag
145145
github.com/IBM/logs-go-sdk v0.4.0/go.mod h1:yv/GCXC4/p+MZEeXl4xjZAOMvDAVRwu61WyHZFKFXQM=
146146
github.com/IBM/logs-router-go-sdk v1.0.8 h1:MU1TdYNdVbvVTUXeqeYPItu6BoiSV/NMN49ySqE7WIY=
147147
github.com/IBM/logs-router-go-sdk v1.0.8/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0=
148-
github.com/IBM/mqcloud-go-sdk v0.3.0 h1:zuRe+lu6IwIzsBsmoVKZT4JgX+GxH5PJG06r5y5Xnh4=
149-
github.com/IBM/mqcloud-go-sdk v0.3.0/go.mod h1:7zigCUz6k3eRrNE8KOcDkY72oPppEmoQifF+SB0NPRM=
148+
github.com/IBM/mqcloud-go-sdk v0.4.0 h1:BuZNXA6iYEg5OEPr13CMGrhH0ew4rH/4L56b1nFtA10=
149+
github.com/IBM/mqcloud-go-sdk v0.4.0/go.mod h1:7zigCUz6k3eRrNE8KOcDkY72oPppEmoQifF+SB0NPRM=
150150
github.com/IBM/networking-go-sdk v0.51.12 h1:2qv6neG8msFR1dtf9v+rbaC2gIkw9HnzohvQpgVye5w=
151151
github.com/IBM/networking-go-sdk v0.51.12/go.mod h1:TAXWyBUk3C3R7aS1m84EfKdnDcBMZMAClwLfDj/SYZc=
152152
github.com/IBM/platform-services-go-sdk v0.86.1 h1:ngBpaXvUF3gmLvbU1Z4lX1wowOSYgGoKBEBaR/urt30=

ibm/service/mqcloud/data_source_ibm_mqcloud_user.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
/*
5-
* IBM OpenAPI Terraform Generator Version: 3.104.0-b4a47c49-20250418-184351
5+
* IBM OpenAPI Terraform Generator Version: 3.107.1-41b0fbd0-20250825-080732
66
*/
77

88
package mqcloud
@@ -62,6 +62,19 @@ func DataSourceIbmMqcloudUser() *schema.Resource {
6262
Computed: true,
6363
Description: "The IAM ID of the user.",
6464
},
65+
"roles": {
66+
Type: schema.TypeList,
67+
Computed: true,
68+
Description: "A list of roles the user has.",
69+
Elem: &schema.Schema{
70+
Type: schema.TypeString,
71+
},
72+
},
73+
"iam_managed": {
74+
Type: schema.TypeBool,
75+
Computed: true,
76+
Description: "Indicates whether the user is managed by IAM.",
77+
},
6578
"href": {
6679
Type: schema.TypeString,
6780
Computed: true,
@@ -156,6 +169,8 @@ func DataSourceIbmMqcloudUserUserDetailsToMap(model *mqcloudv1.UserDetails) (map
156169
modelMap["name"] = *model.Name
157170
modelMap["email"] = *model.Email
158171
modelMap["iam_service_id"] = *model.IamServiceID
172+
modelMap["roles"] = model.Roles
173+
modelMap["iam_managed"] = *model.IamManaged
159174
modelMap["href"] = *model.Href
160175
return modelMap, nil
161176
}

ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
/*
5-
* IBM OpenAPI Terraform Generator Version: 3.104.0-b4a47c49-20250418-184351
5+
* IBM OpenAPI Terraform Generator Version: 3.107.1-41b0fbd0-20250825-080732
66
*/
77

88
package mqcloud_test
@@ -66,6 +66,8 @@ func TestDataSourceIbmMqcloudUserUserDetailsToMap(t *testing.T) {
6666
model["name"] = "testString"
6767
model["email"] = "[email protected]"
6868
model["iam_service_id"] = "testString"
69+
model["roles"] = []string{"testString"}
70+
model["iam_managed"] = true
6971
model["href"] = "testString"
7072

7173
assert.Equal(t, result, model)
@@ -76,6 +78,8 @@ func TestDataSourceIbmMqcloudUserUserDetailsToMap(t *testing.T) {
7678
model.Name = core.StringPtr("testString")
7779
model.Email = core.StringPtr("[email protected]")
7880
model.IamServiceID = core.StringPtr("testString")
81+
model.Roles = []string{"testString"}
82+
model.IamManaged = core.BoolPtr(true)
7983
model.Href = core.StringPtr("testString")
8084

8185
result, err := mqcloud.DataSourceIbmMqcloudUserUserDetailsToMap(model)

ibm/service/mqcloud/resource_ibm_mqcloud_user.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
/*
5-
* IBM OpenAPI Terraform Generator Version: 3.104.0-b4a47c49-20250418-184351
5+
* IBM OpenAPI Terraform Generator Version: 3.107.1-41b0fbd0-20250825-080732
66
*/
77

88
package mqcloud
@@ -54,6 +54,17 @@ func ResourceIbmMqcloudUser() *schema.Resource {
5454
Computed: true,
5555
Description: "The IAM ID of the user.",
5656
},
57+
"roles": {
58+
Type: schema.TypeList,
59+
Computed: true,
60+
Description: "A list of roles the user has.",
61+
Elem: &schema.Schema{Type: schema.TypeString},
62+
},
63+
"iam_managed": {
64+
Type: schema.TypeBool,
65+
Computed: true,
66+
Description: "Indicates whether the user is managed by IAM.",
67+
},
5768
"href": {
5869
Type: schema.TypeString,
5970
Computed: true,
@@ -173,6 +184,14 @@ func resourceIbmMqcloudUserRead(context context.Context, d *schema.ResourceData,
173184
err = fmt.Errorf("Error setting iam_service_id: %s", err)
174185
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_mqcloud_user", "read", "set-iam_service_id").GetDiag()
175186
}
187+
if err = d.Set("roles", userDetails.Roles); err != nil {
188+
err = fmt.Errorf("Error setting roles: %s", err)
189+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_mqcloud_user", "read", "set-roles").GetDiag()
190+
}
191+
if err = d.Set("iam_managed", userDetails.IamManaged); err != nil {
192+
err = fmt.Errorf("Error setting iam_managed: %s", err)
193+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_mqcloud_user", "read", "set-iam_managed").GetDiag()
194+
}
176195
if err = d.Set("href", userDetails.Href); err != nil {
177196
err = fmt.Errorf("Error setting href: %s", err)
178197
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_mqcloud_user", "read", "set-href").GetDiag()

website/docs/d/mqcloud_user.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ Nested schema for **users**:
4141
* `email` - (String) The email of the user.
4242
* Constraints: The maximum length is `253` characters. The minimum length is `5` characters.
4343
* `href` - (String) The URL for the user details.
44+
* `iam_managed` - (Boolean) Indicates whether the user is managed by IAM.
4445
* `iam_service_id` - (String) The IAM ID of the user.
4546
* Constraints: The maximum length is `50` characters. The minimum length is `5` characters.
4647
* `id` - (String) The ID of the user which was allocated on creation, and can be used for delete calls.
4748
* `name` - (String) The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance.
4849
* Constraints: The maximum length is `12` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][-a-z0-9]*$/`.
50+
* `roles` - (List) A list of roles the user has.
51+
* Constraints: The maximum length is `200` items. The minimum length is `0` items.
4952

website/docs/r/mqcloud_user.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ After your resource is created, you can read values from the listed arguments an
3939

4040
* `id` - The unique identifier of the mqcloud_user.
4141
* `href` - (String) The URL for the user details.
42+
* `iam_managed` - (Boolean) Indicates whether the user is managed by IAM.
4243
* `iam_service_id` - (String) The IAM ID of the user.
4344
* Constraints: The maximum length is `50` characters. The minimum length is `5` characters.
45+
* `roles` - (List) A list of roles the user has.
46+
* Constraints: The maximum length is `200` items. The minimum length is `0` items.
4447
* `user_id` - (String) The ID of the user which was allocated on creation, and can be used for delete calls.
4548

4649

0 commit comments

Comments
 (0)