Skip to content

Commit 7d134b2

Browse files
authored
chore(workspace): revert PR 6330 (#6359)
This reverts commit 637edcf.
1 parent f4103d7 commit 7d134b2

File tree

175 files changed

+5971
-12229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+5971
-12229
lines changed

docs/resources/workspace_user.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,7 @@ The following arguments are supported:
4343

4444
Changing this will create a new resource.
4545

46-
* `active_type` - (Optional, String) Specifies the activation mode of the user. Defaults to **USER_ACTIVATE**.
47-
The valid values are as follows:
48-
+ **USER_ACTIVATE**: Activated by the user.
49-
+ **ADMIN_ACTIVATE**: Activated by the administator.
50-
51-
* `email` - (Optional, String) Specifies the email address of user. The value can contain `1` to `64` characters.
52-
53-
* `phone` - (Optional, String) Specifies the phone number of user.
54-
55-
-> At least one of `email` and `phone` parameters must be provided.
56-
57-
* `password` - (Optional, String) Specifies the initial passowrd of user.
58-
This parameter is available and required when `active_type` is set to **ADMIN_ACTIVATE**.
46+
* `email` - (Required, String) Specifies the email address of user. The value can contain `1` to `64` characters.
5947

6048
* `description` - (Optional, String) Specifies the description of user. The maximum length is `255` characters.
6149

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962
7-
github.com/chnsz/golangsdk v0.0.0-20250218015804-069acf83754c
7+
github.com/chnsz/golangsdk v0.0.0-20250217034539-d16a3d7dc780
88
github.com/hashicorp/go-cleanhttp v0.5.2
99
github.com/hashicorp/go-multierror v1.1.1
1010
github.com/hashicorp/go-uuid v1.0.3
@@ -19,7 +19,7 @@ require (
1919
github.com/tidwall/gjson v1.17.1
2020
github.com/tjfoc/gmsm v1.4.1
2121
go.mongodb.org/mongo-driver v1.12.0
22-
golang.org/x/crypto v0.33.0
22+
golang.org/x/crypto v0.21.0
2323
)
2424

2525
require (
@@ -65,8 +65,8 @@ require (
6565
github.com/vmihailenco/tagparser v0.1.1 // indirect
6666
github.com/zclconf/go-cty v1.11.0 // indirect
6767
golang.org/x/net v0.23.0 // indirect
68-
golang.org/x/sys v0.30.0 // indirect
69-
golang.org/x/text v0.22.0 // indirect
68+
golang.org/x/sys v0.18.0 // indirect
69+
golang.org/x/text v0.14.0 // indirect
7070
google.golang.org/appengine v1.6.7 // indirect
7171
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
7272
google.golang.org/grpc v1.56.3 // indirect

go.sum

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6
2222
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
2323
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
2424
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
25-
github.com/chnsz/golangsdk v0.0.0-20250218015804-069acf83754c h1:kn7DY4ztPd6SltVU0qmw82xKMDc6xG2ADPqyP+vMyr0=
26-
github.com/chnsz/golangsdk v0.0.0-20250218015804-069acf83754c/go.mod h1:Erm4hDWxXgAdbkG3+hhJFgRzEL1TvvcroWzw2Gax4uI=
25+
github.com/chnsz/golangsdk v0.0.0-20250217034539-d16a3d7dc780 h1:diWEvRNeM/FktUT+HWiv6z9LLpG3smWeKCNpAyGq5m0=
26+
github.com/chnsz/golangsdk v0.0.0-20250217034539-d16a3d7dc780/go.mod h1:Erm4hDWxXgAdbkG3+hhJFgRzEL1TvvcroWzw2Gax4uI=
2727
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
2828
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
2929
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@@ -247,9 +247,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
247247
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
248248
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
249249
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
250+
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
250251
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
251-
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
252-
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
253252
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
254253
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
255254
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -310,16 +309,15 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
310309
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
311310
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
312311
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
312+
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
313313
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
314-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
315-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
316314
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
317315
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
318316
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
319317
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
320318
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
319+
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
321320
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
322-
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
323321
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
324322
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
325323
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -329,9 +327,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
329327
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
330328
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
331329
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
330+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
332331
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
333-
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
334-
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
335332
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
336333
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
337334
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=

huaweicloud/services/acceptance/workspace/resource_huaweicloud_workspace_user_test.go

Lines changed: 22 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ func getUserFunc(conf *config.Config, state *terraform.ResourceState) (interface
2525

2626
func TestAccUser_basic(t *testing.T) {
2727
var (
28-
user users.UserDetail
29-
resourceName = "huaweicloud_workspace_user.test"
30-
withAdminActive = "huaweicloud_workspace_user.with_admin_active"
31-
rc = acceptance.InitResourceCheck(resourceName, &user, getUserFunc)
32-
rcWithAdminActive = acceptance.InitResourceCheck(withAdminActive, &user, getUserFunc)
33-
34-
rName = acceptance.RandomAccResourceNameWithDash()
35-
currentTime = time.Now().Format("2006-01-02T15:04:05Z")
36-
password = acceptance.RandomPassword()
28+
user users.UserDetail
29+
resourceName = "huaweicloud_workspace_user.test"
30+
rName = acceptance.RandomAccResourceNameWithDash()
31+
currentTime = time.Now().Format("2006-01-02T15:04:05Z")
32+
)
33+
rc := acceptance.InitResourceCheck(
34+
resourceName,
35+
&user,
36+
getUserFunc,
3737
)
3838

3939
resource.Test(t, resource.TestCase{
@@ -42,50 +42,36 @@ func TestAccUser_basic(t *testing.T) {
4242
CheckDestroy: rc.CheckResourceDestroy(),
4343
Steps: []resource.TestStep{
4444
{
45-
Config: testAccUser_basic_step1(rName, password),
45+
Config: testAccUser_basic(rName),
4646
Check: resource.ComposeTestCheckFunc(
4747
rc.CheckResourceExists(),
4848
resource.TestCheckResourceAttr(resourceName, "name", rName),
49-
resource.TestCheckResourceAttr(resourceName, "active_type", "USER_ACTIVATE"),
5049
resource.TestCheckResourceAttr(resourceName, "email", "[email protected]"),
51-
resource.TestCheckResourceAttr(resourceName, "phone", "+8612345678987"),
5250
resource.TestCheckResourceAttr(resourceName, "description", "Created by acc test"),
5351
resource.TestCheckResourceAttr(resourceName, "account_expires", "0"),
5452
resource.TestCheckResourceAttr(resourceName, "password_never_expires", "false"),
5553
resource.TestCheckResourceAttr(resourceName, "enable_change_password", "true"),
5654
resource.TestCheckResourceAttr(resourceName, "next_login_change_password", "true"),
5755
resource.TestCheckResourceAttr(resourceName, "disabled", "false"),
58-
rcWithAdminActive.CheckResourceExists(),
59-
resource.TestCheckResourceAttr(withAdminActive, "active_type", "ADMIN_ACTIVATE"),
60-
resource.TestCheckResourceAttr(withAdminActive, "disabled", "true"),
61-
resource.TestCheckResourceAttr(withAdminActive, "email", ""),
62-
resource.TestCheckResourceAttr(withAdminActive, "phone", "+8612345678978"),
6356
),
6457
},
6558
{
66-
Config: testAccUser_basic_step2(rName, currentTime, password),
59+
Config: testAccUser_update(rName, currentTime),
6760
Check: resource.ComposeTestCheckFunc(
6861
rc.CheckResourceExists(),
69-
resource.TestCheckResourceAttr(resourceName, "active_type", "ADMIN_ACTIVATE"),
70-
resource.TestCheckResourceAttr(resourceName, "email", ""),
62+
resource.TestCheckResourceAttr(resourceName, "email", "[email protected]"),
7163
resource.TestCheckResourceAttr(resourceName, "description", ""),
7264
resource.TestCheckResourceAttrSet(resourceName, "account_expires"),
7365
resource.TestCheckResourceAttr(resourceName, "password_never_expires", "true"),
7466
resource.TestCheckResourceAttr(resourceName, "enable_change_password", "false"),
7567
resource.TestCheckResourceAttr(resourceName, "next_login_change_password", "false"),
7668
resource.TestCheckResourceAttr(resourceName, "disabled", "true"),
77-
rcWithAdminActive.CheckResourceExists(),
78-
resource.TestCheckResourceAttr(withAdminActive, "active_type", "USER_ACTIVATE"),
79-
resource.TestCheckResourceAttr(withAdminActive, "disabled", "false"),
80-
resource.TestCheckResourceAttr(withAdminActive, "phone", ""),
81-
resource.TestCheckResourceAttr(withAdminActive, "email", "[email protected]"),
8269
),
8370
},
8471
{
85-
ResourceName: resourceName,
86-
ImportState: true,
87-
ImportStateVerify: true,
88-
ImportStateVerifyIgnore: []string{"password"},
72+
ResourceName: resourceName,
73+
ImportState: true,
74+
ImportStateVerify: true,
8975
},
9076
},
9177
})
@@ -107,7 +93,7 @@ resource "huaweicloud_workspace_service" "test" {
10793
`, common.TestBaseNetwork(rName))
10894
}
10995

110-
func testAccUser_basic_step1(rName, password string) string {
96+
func testAccUser_basic(rName string) string {
11197
return fmt.Sprintf(`
11298
%[1]s
11399
@@ -116,55 +102,29 @@ resource "huaweicloud_workspace_user" "test" {
116102
117103
name = "%[2]s"
118104
119-
phone = "+8612345678987"
120105
description = "Created by acc test"
121106
122107
password_never_expires = false
123108
disabled = false
124109
}
125-
126-
resource "huaweicloud_workspace_user" "with_admin_active" {
127-
depends_on = [huaweicloud_workspace_service.test]
128-
129-
name = "%[2]s_with_admin"
130-
active_type = "ADMIN_ACTIVATE"
131-
password = "%[3]s"
132-
phone = "+8612345678978"
133-
134-
password_never_expires = false
135-
disabled = true
136-
}
137-
`, testAccUser_base(rName), rName, password)
110+
`, testAccUser_base(rName), rName)
138111
}
139112

140-
func testAccUser_basic_step2(rName, currentTime, password string) string {
113+
func testAccUser_update(rName, currentTime string) string {
141114
return fmt.Sprintf(`
142115
%[1]s
143116
144117
resource "huaweicloud_workspace_user" "test" {
145-
depends_on = [huaweicloud_workspace_service.test]
118+
depends_on = [huaweicloud_workspace_service.test]
146119
147-
name = "%[2]s"
148-
active_type = "ADMIN_ACTIVATE"
149-
phone = "+8612345678987"
150-
password = "%[4]s"
120+
name = "%[2]s"
121+
151122
152123
account_expires = timeadd("%[3]s", "1h")
153124
password_never_expires = true
154125
enable_change_password = false
155126
next_login_change_password = false
156127
disabled = true
157128
}
158-
159-
resource "huaweicloud_workspace_user" "with_admin_active" {
160-
depends_on = [huaweicloud_workspace_service.test]
161-
162-
name = "%[2]s_with_admin"
163-
active_type = "USER_ACTIVATE"
164-
165-
166-
password_never_expires = false
167-
disabled = false
168-
}
169-
`, testAccUser_base(rName), rName, currentTime, password)
129+
`, testAccUser_base(rName), rName, currentTime)
170130
}

huaweicloud/services/workspace/resource_huaweicloud_workspace_user.go

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ func ResourceUser() *schema.Resource {
5252
},
5353
"email": {
5454
Type: schema.TypeString,
55-
Optional: true,
56-
},
57-
"phone": {
58-
Type: schema.TypeString,
59-
Optional: true,
55+
Required: true,
6056
},
6157
"description": {
6258
Type: schema.TypeString,
@@ -85,16 +81,6 @@ func ResourceUser() *schema.Resource {
8581
Type: schema.TypeBool,
8682
Optional: true,
8783
},
88-
"active_type": {
89-
Type: schema.TypeString,
90-
Optional: true,
91-
Computed: true,
92-
},
93-
"password": {
94-
Type: schema.TypeString,
95-
Optional: true,
96-
Sensitive: true,
97-
},
9884
"locked": {
9985
Type: schema.TypeBool,
10086
Computed: true,
@@ -126,10 +112,7 @@ func translateUTC0Time(timeStr string) (string, error) {
126112
func buildUserCreateOpts(d *schema.ResourceData) (users.CreateOpts, error) {
127113
result := users.CreateOpts{
128114
Name: d.Get("name").(string),
129-
ActiveType: d.Get("active_type").(string),
130115
Email: d.Get("email").(string),
131-
Phone: d.Get("phone").(string),
132-
Password: d.Get("password").(string),
133116
Description: d.Get("description").(string),
134117
EnableChangePassword: utils.Bool(d.Get("enable_change_password").(bool)),
135118
NextLoginChangePassword: utils.Bool(d.Get("next_login_change_password").(bool)),
@@ -190,9 +173,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac
190173
mErr := multierror.Append(nil,
191174
d.Set("region", region),
192175
d.Set("name", resp.Name),
193-
d.Set("active_type", resp.ActiveType),
194176
d.Set("email", resp.Email),
195-
d.Set("phone", resp.Phone),
196177
d.Set("description", resp.Description),
197178
d.Set("account_expires", parseUserAccountExpires(resp.AccountExpires)),
198179
d.Set("enable_change_password", resp.EnableChangePassword),
@@ -210,9 +191,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac
210191

211192
func buildUserUpdateOpts(d *schema.ResourceData) (users.UpdateOpts, error) {
212193
result := users.UpdateOpts{
213-
ActiveType: d.Get("active_type").(string),
214-
Email: utils.String(d.Get("email").(string)),
215-
Phone: utils.String(d.Get("phone").(string)),
194+
Email: d.Get("email").(string),
216195
Description: utils.String(d.Get("description").(string)),
217196
EnableChangePassword: utils.Bool(d.Get("enable_change_password").(bool)),
218197
NextLoginChangePassword: utils.Bool(d.Get("next_login_change_password").(bool)),

vendor/github.com/chnsz/golangsdk/openstack/workspace/v2/users/requests.go

Lines changed: 2 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/chnsz/golangsdk/openstack/workspace/v2/users/results.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/crypto/LICENSE

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/crypto/blowfish/cipher.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)