Skip to content

Commit 8a1d3e9

Browse files
authored
Merge pull request #747 from SumoLogic/erikatsumo-fix-rolev2
Preserve assigned users when updating RoleV2
2 parents 6ca2ccf + d26bd31 commit 8a1d3e9

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
BUG FIXES:
55
* Properly send optional webhook notification payload value
66
* RoleV2 creation will no longer time out when selection_type is not specified
7+
* RoleV2 update will not remove all assigned users
78

89
MAINTENANCE:
910
* Bump version of golang.org/x/net to v0.35.0

sumologic/resource_sumologic_role_v2.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
// ----------------------------------------------------------------------------
2-
//
3-
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4-
//
5-
// ----------------------------------------------------------------------------
6-
//
7-
// This file is automatically generated by Sumo Logic and manual
8-
// changes will be clobbered when the file is regenerated. Do not submit
9-
// changes to this file.
10-
//
11-
// ----------------------------------------------------------------------------
121
package sumologic
132

143
import (
@@ -133,6 +122,11 @@ func resourceSumologicRoleV2Update(d *schema.ResourceData, meta interface{}) err
133122
c := meta.(*Client)
134123

135124
roleV2 := resourceToRoleV2(d)
125+
126+
id := d.Id()
127+
retrievedRoleV2, _ := c.GetRole(id)
128+
roleV2.Users = retrievedRoleV2.Users
129+
136130
err := c.UpdateRoleV2(roleV2)
137131
if err != nil {
138132
return err
@@ -181,6 +175,7 @@ func resourceToRoleV2(d *schema.ResourceData) RoleV2 {
181175
SelectionType: d.Get("selection_type").(string),
182176
LogAnalyticsFilter: d.Get("log_analytics_filter").(string),
183177
Capabilities: capabilities,
178+
Users: make([]string, 0),
184179
}
185180
}
186181

sumologic/sumologic_role_v2.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type RoleV2 struct {
9090
SelectionType string `json:"selectionType,omitempty"`
9191
SelectedViews []ViewFilterDefinition `json:"selectedViews,omitempty"`
9292
Description string `json:"description"`
93+
Users []string `json:"users"`
9394
}
9495

9596
type ViewFilterDefinition struct {

0 commit comments

Comments
 (0)