Skip to content

Commit f1bf782

Browse files
authored
Migrate the System User resource to the plugin framework. (elastic#1154)
* Migrate system user to plugin fw * Move the resource to it's own package * Add missing conflict validators * Add missing elasticsearch connection block make docs-generate * Use elasticsearch_connection when provided * Don't keep this one comment though * Add acctest to cover sdk->pf migration * Update system user client funcs to use fw diags * Address PR feedback * Changelog
1 parent dfd20f1 commit f1bf782

25 files changed

+504
-293
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## [Unreleased]
22

33
- Add `headers` for the provider connection ([#1057](https://github.com/elastic/terraform-provider-elasticstack/pull/1057))
4+
- Migrate `elasticstack_elasticsearch_system_user` resource to Terraform plugin framework ([#1154](https://github.com/elastic/terraform-provider-elasticstack/pull/1154))
45
- Add custom `endpoint` configuration support for snapshot repository setup ([#1158](https://github.com/elastic/terraform-provider-elasticstack/pull/1158))
56

67
## [0.11.15] - 2025-04-23

docs/resources/elasticsearch_security_system_user.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ resource "elasticstack_elasticsearch_security_system_user" "kibana_system" {
4141

4242
### Optional
4343

44-
- `elasticsearch_connection` (Block List, Max: 1, Deprecated) Elasticsearch connection configuration block. This property will be removed in a future provider version. Configure the Elasticsearch connection via the provider configuration instead. (see [below for nested schema](#nestedblock--elasticsearch_connection))
44+
- `elasticsearch_connection` (Block List, Deprecated) Elasticsearch connection configuration block. (see [below for nested schema](#nestedblock--elasticsearch_connection))
4545
- `enabled` (Boolean) Specifies whether the user is enabled. The default value is true.
46-
- `password` (String, Sensitive) The users password. Passwords must be at least 6 characters long.
47-
- `password_hash` (String, Sensitive) A hash of the users password. This must be produced using the same hashing algorithm as has been configured for password storage (see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html#hashing-settings).
46+
- `password` (String, Sensitive) The user's password. Passwords must be at least 6 characters long.
47+
- `password_hash` (String, Sensitive) A hash of the user's password. This must be produced using the same hashing algorithm as has been configured for password storage (see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html#hashing-settings).
4848

4949
### Read-Only
5050

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/agext/levenshtein v1.2.3 // indirect
3232
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
3333
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
34-
github.com/cloudflare/circl v1.6.0 // indirect
34+
github.com/cloudflare/circl v1.6.1 // indirect
3535
github.com/davecgh/go-spew v1.1.1 // indirect
3636
github.com/fatih/color v1.17.0 // indirect
3737
github.com/go-logr/logr v1.4.2 // indirect
@@ -68,18 +68,18 @@ require (
6868
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
6969
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
7070
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
71-
github.com/zclconf/go-cty v1.16.2 // indirect
71+
github.com/zclconf/go-cty v1.16.3 // indirect
7272
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
7373
go.opentelemetry.io/otel v1.34.0 // indirect
7474
go.opentelemetry.io/otel/metric v1.34.0 // indirect
7575
go.opentelemetry.io/otel/trace v1.34.0 // indirect
76-
golang.org/x/crypto v0.38.0 // indirect
77-
golang.org/x/mod v0.24.0 // indirect
78-
golang.org/x/net v0.39.0 // indirect
79-
golang.org/x/sync v0.14.0 // indirect
76+
golang.org/x/crypto v0.39.0 // indirect
77+
golang.org/x/mod v0.25.0 // indirect
78+
golang.org/x/net v0.40.0 // indirect
79+
golang.org/x/sync v0.15.0 // indirect
8080
golang.org/x/sys v0.33.0 // indirect
81-
golang.org/x/text v0.25.0 // indirect
82-
golang.org/x/tools v0.23.0 // indirect
81+
golang.org/x/text v0.26.0 // indirect
82+
golang.org/x/tools v0.33.0 // indirect
8383
google.golang.org/appengine v1.6.8 // indirect
8484
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
8585
google.golang.org/grpc v1.72.1 // indirect

go.sum

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmms
1515
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
1616
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
1717
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
18-
github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk=
19-
github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
18+
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
19+
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
2020
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
2121
github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
2222
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -186,8 +186,8 @@ github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7V
186186
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
187187
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
188188
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
189-
github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70=
190-
github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
189+
github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk=
190+
github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
191191
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
192192
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
193193
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
@@ -206,22 +206,22 @@ go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
206206
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
207207
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
208208
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
209-
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
210-
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
209+
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
210+
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
211211
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
212-
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
213-
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
212+
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
213+
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
214214
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
215215
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
216216
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
217217
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
218-
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
219-
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
218+
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
219+
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
220220
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
221221
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
222222
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
223-
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
224-
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
223+
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
224+
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
225225
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
226226
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
227227
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -245,15 +245,15 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
245245
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
246246
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
247247
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
248-
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
249-
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
248+
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
249+
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
250250
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
251251
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
252252
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
253253
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
254254
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
255-
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
256-
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
255+
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
256+
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
257257
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
258258
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
259259
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

internal/utils/testutils.go renamed to internal/acctest/checks/resource_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package utils
1+
package checks
22

33
import (
44
"fmt"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package checks
2+
3+
import (
4+
"encoding/base64"
5+
"fmt"
6+
"io"
7+
8+
"github.com/elastic/terraform-provider-elasticstack/internal/clients"
9+
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
10+
)
11+
12+
func CheckUserCanAuthenticate(username string, password string) func(*terraform.State) error {
13+
return func(s *terraform.State) error {
14+
client, err := clients.NewAcceptanceTestingClient()
15+
if err != nil {
16+
return err
17+
}
18+
19+
esClient, err := client.GetESClient()
20+
if err != nil {
21+
return err
22+
}
23+
24+
credentials := fmt.Sprintf("%s:%s", username, password)
25+
authHeader := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(credentials)))
26+
27+
req := esClient.Security.Authenticate.WithHeader(map[string]string{"Authorization": authHeader})
28+
resp, err := esClient.Security.Authenticate(req)
29+
if err != nil {
30+
return err
31+
}
32+
33+
defer resp.Body.Close()
34+
35+
if resp.IsError() {
36+
body, err := io.ReadAll(resp.Body)
37+
38+
return fmt.Errorf("failed to authenticate as test user [%s] %s %s", username, body, err)
39+
}
40+
return nil
41+
}
42+
}

internal/clients/elasticsearch/security.go

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,60 +89,88 @@ func DeleteUser(ctx context.Context, apiClient *clients.ApiClient, username stri
8989
return diags
9090
}
9191

92-
func EnableUser(ctx context.Context, apiClient *clients.ApiClient, username string) diag.Diagnostics {
93-
var diags diag.Diagnostics
92+
func EnableUser(ctx context.Context, apiClient *clients.ApiClient, username string) fwdiag.Diagnostics {
93+
var diags fwdiag.Diagnostics
9494
esClient, err := apiClient.GetESClient()
9595
if err != nil {
96-
return diag.FromErr(err)
96+
diags.AddError(
97+
"Unable to get Elasticsearch client",
98+
err.Error(),
99+
)
100+
return diags
97101
}
98102
res, err := esClient.Security.EnableUser(username, esClient.Security.EnableUser.WithContext(ctx))
99103
if err != nil {
100-
return diag.FromErr(err)
104+
diags.AddError(
105+
"Unable to enable system user",
106+
err.Error(),
107+
)
108+
return diags
101109
}
102110
defer res.Body.Close()
103-
if diags := utils.CheckError(res, "Unable to enable system user"); diags.HasError() {
111+
if diags := utils.CheckErrorFromFW(res, "Unable to enable system user"); diags.HasError() {
104112
return diags
105113
}
106114
return diags
107115
}
108116

109-
func DisableUser(ctx context.Context, apiClient *clients.ApiClient, username string) diag.Diagnostics {
110-
var diags diag.Diagnostics
117+
func DisableUser(ctx context.Context, apiClient *clients.ApiClient, username string) fwdiag.Diagnostics {
118+
var diags fwdiag.Diagnostics
111119
esClient, err := apiClient.GetESClient()
112120
if err != nil {
113-
return diag.FromErr(err)
121+
diags.AddError(
122+
"Unable to get Elasticsearch client",
123+
err.Error(),
124+
)
125+
return diags
114126
}
115127
res, err := esClient.Security.DisableUser(username, esClient.Security.DisableUser.WithContext(ctx))
116128
if err != nil {
117-
return diag.FromErr(err)
129+
diags.AddError(
130+
"Unable to disable system user",
131+
err.Error(),
132+
)
133+
return diags
118134
}
119135
defer res.Body.Close()
120-
if diags := utils.CheckError(res, "Unable to disable system user"); diags.HasError() {
136+
if diags := utils.CheckErrorFromFW(res, "Unable to disable system user"); diags.HasError() {
121137
return diags
122138
}
123139
return diags
124140
}
125141

126-
func ChangeUserPassword(ctx context.Context, apiClient *clients.ApiClient, username string, userPassword *models.UserPassword) diag.Diagnostics {
127-
var diags diag.Diagnostics
142+
func ChangeUserPassword(ctx context.Context, apiClient *clients.ApiClient, username string, userPassword *models.UserPassword) fwdiag.Diagnostics {
143+
var diags fwdiag.Diagnostics
128144
userPasswordBytes, err := json.Marshal(userPassword)
129145
if err != nil {
130-
return diag.FromErr(err)
146+
diags.AddError(
147+
"Unable to marshal user password",
148+
err.Error(),
149+
)
150+
return diags
131151
}
132152
esClient, err := apiClient.GetESClient()
133153
if err != nil {
134-
return diag.FromErr(err)
154+
diags.AddError(
155+
"Unable to get Elasticsearch client",
156+
err.Error(),
157+
)
158+
return diags
135159
}
136160
res, err := esClient.Security.ChangePassword(
137161
bytes.NewReader(userPasswordBytes),
138162
esClient.Security.ChangePassword.WithUsername(username),
139163
esClient.Security.ChangePassword.WithContext(ctx),
140164
)
141165
if err != nil {
142-
return diag.FromErr(err)
166+
diags.AddError(
167+
"Unable to change user password",
168+
err.Error(),
169+
)
170+
return diags
143171
}
144172
defer res.Body.Close()
145-
if diags := utils.CheckError(res, "Unable to change user's password"); diags.HasError() {
173+
if diags := utils.CheckErrorFromFW(res, "Unable to change user's password"); diags.HasError() {
146174
return diags
147175
}
148176
return diags

internal/elasticsearch/security/role_data_source_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55

66
"github.com/elastic/terraform-provider-elasticstack/internal/acctest"
7-
"github.com/elastic/terraform-provider-elasticstack/internal/utils"
7+
"github.com/elastic/terraform-provider-elasticstack/internal/acctest/checks"
88
"github.com/elastic/terraform-provider-elasticstack/internal/versionutils"
99
"github.com/hashicorp/go-version"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -21,11 +21,11 @@ func TestAccDataSourceSecurityRole(t *testing.T) {
2121
Check: resource.ComposeTestCheckFunc(
2222
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "name", "data_source_test"),
2323
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "cluster.*", "all"),
24-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
24+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
2525
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.privileges.*", "all"),
2626
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.allow_restricted_indices", "true"),
2727
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.application", "myapp"),
28-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
28+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
2929
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.resources.*", "*"),
3030
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "run_as.*", "other_user"),
3131
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "metadata", `{"version":1}`),
@@ -37,11 +37,11 @@ func TestAccDataSourceSecurityRole(t *testing.T) {
3737
Check: resource.ComposeTestCheckFunc(
3838
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "name", "data_source_test"),
3939
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "cluster.*", "all"),
40-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
40+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
4141
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.privileges.*", "all"),
4242
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.allow_restricted_indices", "true"),
4343
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.application", "myapp"),
44-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
44+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
4545
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.resources.*", "*"),
4646
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "run_as.*", "other_user"),
4747
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "metadata", `{"version":1}`),
@@ -55,11 +55,11 @@ func TestAccDataSourceSecurityRole(t *testing.T) {
5555
Check: resource.ComposeTestCheckFunc(
5656
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "name", "data_source_test"),
5757
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "cluster.*", "all"),
58-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
58+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.names", []string{"index1", "index2"}),
5959
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.privileges.*", "all"),
6060
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "indices.0.allow_restricted_indices", "true"),
6161
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.application", "myapp"),
62-
utils.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
62+
checks.TestCheckResourceListAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.privileges", []string{"admin", "read"}),
6363
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "applications.0.resources.*", "*"),
6464
resource.TestCheckTypeSetElemAttr("data.elasticstack_elasticsearch_security_role.test", "run_as.*", "other_user"),
6565
resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_security_role.test", "metadata", `{"version":1}`),

0 commit comments

Comments
 (0)