@@ -25,9 +25,18 @@ func resourceElasticsearchOpenDistroUser() *schema.Resource {
25
25
Required : true ,
26
26
},
27
27
"password" : {
28
- Type : schema .TypeString ,
29
- Required : true ,
30
- Sensitive : true ,
28
+ Type : schema .TypeString ,
29
+ Optional : true ,
30
+ Sensitive : true ,
31
+ DiffSuppressFunc : onlyDiffOnCreate ,
32
+ ConflictsWith : []string {"password_hash" },
33
+ },
34
+ "password_hash" : {
35
+ Type : schema .TypeString ,
36
+ Optional : true ,
37
+ Sensitive : true ,
38
+ DiffSuppressFunc : onlyDiffOnCreate ,
39
+ ConflictsWith : []string {"password" },
31
40
},
32
41
"backend_roles" : {
33
42
Type : schema .TypeSet ,
@@ -159,6 +168,7 @@ func resourceElasticsearchPutOpenDistroUser(d *schema.ResourceData, m interface{
159
168
Description : d .Get ("description" ).(string ),
160
169
Attributes : d .Get ("attributes" ).(map [string ]interface {}),
161
170
Password : d .Get ("password" ).(string ),
171
+ PasswordHash : d .Get ("password_hash" ).(string ),
162
172
}
163
173
164
174
userJSON , err := json .Marshal (userDefinition )
@@ -204,6 +214,7 @@ type UserBody struct {
204
214
Attributes map [string ]interface {} `json:"attributes"`
205
215
Description string `json:"description"`
206
216
Password string `json:"password"`
217
+ PasswordHash string `json:"hash"`
207
218
}
208
219
209
220
// UserResponse sent by the odfe's API
0 commit comments