Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: user invite invited_users issue #3864

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions ibm/service/iampolicy/resource_ibm_iam_user_invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ func ResourceIBMIAMUserInvite() *schema.Resource {
Computed: true,
Description: "ID of the resource group.",
},
"service_type": {
Type: schema.TypeString,
Computed: true,
Description: "Service type of the policy definition",
},

"attributes": {
Type: schema.TypeMap,
Expand Down Expand Up @@ -387,7 +392,11 @@ func ResourceIBMIAMUserInvite() *schema.Resource {
Computed: true,
Description: "ID of the resource group.",
},

"service_type": {
Type: schema.TypeString,
Computed: true,
Description: "Service type of the policy definition",
},
"attributes": {
Type: schema.TypeMap,
Computed: true,
Expand Down Expand Up @@ -595,13 +604,15 @@ func resourceIBMIAMGetUsers(d *schema.ResourceData, meta interface{}) error {
roles[i] = *role.DisplayName
}
//populate policy resources
resources := flex.FlattenPolicyResource(policy.Resources)
// userResources := make([]map[string]interface{}, 0)
userResources := flex.FlattenPolicyResource(policy.Resources)
p := map[string]interface{}{
"id": policy.ID,
"roles": roles,
"resources": resources,
"resources": userResources,
}
userPolicies = append(userPolicies, p)

}

listAccessGroupOptions := &iamaccessgroupsv2.ListAccessGroupsOptions{
Expand Down Expand Up @@ -634,17 +645,17 @@ func resourceIBMIAMGetUsers(d *schema.ResourceData, meta interface{}) error {
roles[i] = *role.DisplayName
}
//populate policy resources
resources := flex.FlattenPolicyResource(policy.Resources)
grpResources := flex.FlattenPolicyResource(policy.Resources)
p := map[string]interface{}{
"id": policy.ID,
"roles": roles,
"resources": resources,
"resources": grpResources,
}
grpPolicies = append(grpPolicies, p)
}
//populate name & policies of a access group
agInfo := map[string]interface{}{
"name": grpData.Name,
"name": *grpData.Name,
"policies": grpPolicies,
}
//add agInfo to list of access groups
Expand Down