-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.tf
More file actions
31 lines (27 loc) · 759 Bytes
/
user.tf
File metadata and controls
31 lines (27 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
resource "restapi_object" "user" {
path = "/users"
id_attribute = "name"
object_id = local.username
force_new = [local.username]
destroy_path = "/skip"
data = jsonencode({
name = local.username
password = random_password.this.result
useExisting = true
})
}
resource "restapi_object" "db_privileges" {
path = "/databases/${local.database_name}/db_privileges"
id_attribute = "username"
object_id = "${local.database_name}::${local.username}"
force_new = [local.database_name, local.username]
destroy_path = "/skip"
data = jsonencode({
database = local.database_name
username = local.username
})
depends_on = [
restapi_object.database,
restapi_object.user
]
}