Skip to content

Commit 6662b37

Browse files
committed
fix: resource_me_identity update
1 parent 31f734c commit 6662b37

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

ovh/resource_me_identity_user.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,15 @@ func resourceMeIdentityUserUpdate(d *schema.ResourceData, meta interface{}) erro
138138
description := d.Get("description").(string)
139139
email := d.Get("email").(string)
140140
group := d.Get("group").(string)
141-
login := d.Get("login").(string)
142141
params := &MeIdentityUserUpdateOpts{
143-
Login: login,
144142
Description: description,
145143
Email: email,
146144
Group: group,
147145
}
148146
err := config.OVHClient.Put(
149147
fmt.Sprintf("/me/identity/user/%s", id),
150-
nil,
151148
params,
149+
nil,
152150
)
153151
if err != nil {
154152
return fmt.Errorf("Unable to update identity user %s:\n\t %q", id, err)

ovh/resource_me_identity_user_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,34 @@ func TestAccMeIdentityUser_basic(t *testing.T) {
8080
})
8181
}
8282

83+
func TestAccMeIdentityUser_update(t *testing.T) {
84+
desc := "Identity user created by Terraform Acc."
85+
email := "[email protected]"
86+
group := "DEFAULT"
87+
login := acctest.RandomWithPrefix(test_prefix)
88+
password := base64.StdEncoding.EncodeToString([]byte(acctest.RandomWithPrefix(test_prefix)))
89+
90+
newEmail := "[email protected]"
91+
92+
resource.Test(t, resource.TestCase{
93+
PreCheck: func() { testAccPreCheckCredentials(t) },
94+
Providers: testAccProviders,
95+
Steps: []resource.TestStep{
96+
{
97+
Config: fmt.Sprintf(testAccMeIdentityUserConfig, desc, email, group, login, password),
98+
Check: resource.ComposeTestCheckFunc(
99+
checkIdentityUserResourceAttr("ovh_me_identity_user.user_1", desc, email, group, login)...,
100+
),
101+
},
102+
{
103+
Config: fmt.Sprintf(testAccMeIdentityUserConfig, desc, newEmail, group, login, password),
104+
Check: resource.ComposeTestCheckFunc(
105+
checkIdentityUserResourceAttr("ovh_me_identity_user.user_1", desc, newEmail, group, login)...,
106+
),
107+
}},
108+
})
109+
}
110+
83111
const testAccMeIdentityUserConfig = `
84112
resource "ovh_me_identity_user" "user_1" {
85113
description = "%s"

ovh/types_me.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ type MeIdentityUserCreateOpts struct {
173173
}
174174

175175
type MeIdentityUserUpdateOpts struct {
176-
Login string `json:"user"`
177176
Description string `json:"description"`
178177
Email string `json:"email"`
179178
Group string `json:"group"`

0 commit comments

Comments
 (0)