Skip to content

Commit 2671e71

Browse files
committed
Add ForceNew to a user's email address
1 parent 52dcd6c commit 2671e71

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
## X.Y.Z (Unreleased)
22
* Add new change notes here
33

4+
BUG FIXES:
5+
* When the email of a sumologic_user is changed, instead of silently doing nothing, an error will be raised to the user
6+
7+
DOCS:
8+
* Updated content docs to include examples of different alerts
9+
410
## 3.0.10 (May 6, 2025)
511

612
BUG FIXES:
713
* Fix the log mapping resource to no longer error out when empty strings are included in skipped_values
814
* Fix the log mapping resource to no longer default to a skipped_index of 0 when no skipped_index is specified
915

10-
DOCS:
11-
* Updated content docs to include examples of different alerts
12-
1316
## 3.0.9 (April 28, 2025)
1417

1518
FEATURES:

sumologic/fields_map.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var FieldsMap = map[string]map[string]string{
99
"transferTo": "",
1010
"updatedFirstName": "TestUpdated",
1111
"updatedLastName": "UserUpdated",
12-
"updatedEmail": "testterraform@demo.com",
12+
"updatedEmail": "testterraformupdated@demo.com",
1313
"updatedIsActive": "false",
1414
"preUpdateTransferTo": "nonExistentTestId",
1515
},

sumologic/resource_sumologic_user.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ func resourceSumologicUserCreate(d *schema.ResourceData, meta interface{}) error
112112
func resourceSumologicUserUpdate(d *schema.ResourceData, meta interface{}) error {
113113
c := meta.(*Client)
114114

115+
if d.HasChange("email") {
116+
return fmt.Errorf("a user's email may not be changed")
117+
}
118+
115119
user := resourceToUser(d)
116120

117121
err := c.UpdateUser(user)

sumologic/resource_sumologic_user_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package sumologic
1313

1414
import (
1515
"fmt"
16+
"regexp"
1617
"strconv"
1718
"strings"
1819
"testing"
@@ -149,17 +150,21 @@ func TestAccSumologicUser_update(t *testing.T) {
149150
),
150151
},
151152
{
152-
Config: testAccSumologicUserUpdate(testUpdatedFirstName, testUpdatedLastName, testUpdatedEmail, testUpdatedIsActive, testTransferTo),
153+
Config: testAccSumologicUserUpdate(testUpdatedFirstName, testUpdatedLastName, testEmail, testUpdatedIsActive, testTransferTo),
153154
Check: resource.ComposeTestCheckFunc(
154155
testAccCheckUserExists("sumologic_user.test", &user, t),
155156
testAccCheckUserAttributes("sumologic_user.test"),
156157
resource.TestCheckResourceAttr("sumologic_user.test", "first_name", testUpdatedFirstName),
157158
resource.TestCheckResourceAttr("sumologic_user.test", "last_name", testUpdatedLastName),
158-
resource.TestCheckResourceAttr("sumologic_user.test", "email", testUpdatedEmail),
159+
resource.TestCheckResourceAttr("sumologic_user.test", "email", testEmail),
159160
resource.TestCheckResourceAttr("sumologic_user.test", "is_active", strconv.FormatBool(testUpdatedIsActive)),
160161
resource.TestCheckResourceAttr("sumologic_user.test", "transfer_to", testTransferTo),
161162
),
162163
},
164+
{
165+
Config: testAccSumologicUserUpdate(testUpdatedFirstName, testUpdatedLastName, testUpdatedEmail, testUpdatedIsActive, testTransferTo),
166+
ExpectError: regexp.MustCompile(`a user's email may not be changed`),
167+
},
163168
},
164169
})
165170
}

website/docs/r/user.html.markdown

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,16 @@ Users can be imported using the user id, e.g.:
5959
terraform import sumologic_user.user 1234567890
6060
```
6161

62+
## Transfered content and email updates
63+
64+
When a user is deleted, all of that user's content is transferred to another user. If `transfer_to` is
65+
set to another user's ID, then the content will be assigned to that user. If `transfer_to` is empty,
66+
then it will instead be assigned to the user executing the delete operation.
67+
68+
A user's email address may not be changed. As a workaround, you may:
69+
70+
1. create a new `sumologic_user` with the desired email address
71+
2. set the `transfer_to` of the existing user to the new user's ID
72+
3. delete the user with the old email address
73+
6274
[1]: https://help.sumologic.com/Manage/Users-and-Roles/Manage-Users

0 commit comments

Comments
 (0)