Skip to content

Commit 1f508c5

Browse files
Implement user resource, group resource and roles data source (#6)
* user_resource: added * roles_data_source: added * group_resource: added
1 parent a139590 commit 1f508c5

File tree

9 files changed

+797
-0
lines changed

9 files changed

+797
-0
lines changed

docs/data-sources/roles.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "passbolt_roles Data Source - passbolt"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# passbolt_roles (Data Source)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "passbolt_user" "dummy" {
17+
username = "dummy@test.com"
18+
firstname = "Johnny"
19+
lastname = "Test"
20+
role = local.role_admin_id
21+
}
22+
23+
data "passbolt_roles" "all" {}
24+
25+
output "out" {
26+
value = data.passbolt_roles.all.roles
27+
}
28+
29+
locals {
30+
role_admin_id = one([for item in data.passbolt_roles.all.roles : item if item.name == "admin"]).id
31+
role_user_id = one([for item in data.passbolt_roles.all.roles : item if item.name == "user"]).id
32+
}
33+
```
34+
35+
<!-- schema generated by tfplugindocs -->
36+
## Schema
37+
38+
### Read-Only
39+
40+
- `roles` (Attributes List) (see [below for nested schema](#nestedatt--roles))
41+
42+
<a id="nestedatt--roles"></a>
43+
### Nested Schema for `roles`
44+
45+
Read-Only:
46+
47+
- `description` (String)
48+
- `id` (String)
49+
- `name` (String)

docs/resources/group.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "passbolt_group Resource - passbolt"
4+
subcategory: ""
5+
description: |-
6+
A Passbolt User Resource.
7+
---
8+
9+
# passbolt_group (Resource)
10+
11+
A Passbolt User Resource.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "passbolt_group" "grp" {
17+
name = "devops-team"
18+
19+
group_users = [
20+
{
21+
user_id = "5f8642a0-f3e3-403b-b666-8cda965fbad6"
22+
is_admin = true
23+
},
24+
]
25+
}
26+
```
27+
28+
<!-- schema generated by tfplugindocs -->
29+
## Schema
30+
31+
### Required
32+
33+
- `group_users` (Attributes List) (see [below for nested schema](#nestedatt--group_users))
34+
- `name` (String) The group name.
35+
36+
### Read-Only
37+
38+
- `id` (String) The group id.
39+
40+
<a id="nestedatt--group_users"></a>
41+
### Nested Schema for `group_users`
42+
43+
Required:
44+
45+
- `user_id` (String) The id of the user to add.
46+
47+
Optional:
48+
49+
- `delete` (Boolean) Whether the user should be deleted from the group
50+
- `is_admin` (Boolean) Whether to make the user admin of the group.

docs/resources/user.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "passbolt_user Resource - passbolt"
4+
subcategory: ""
5+
description: |-
6+
A Passbolt User Resource.
7+
---
8+
9+
# passbolt_user (Resource)
10+
11+
A Passbolt User Resource.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `firstname` (String) The first name of the user.
21+
- `lastname` (String) The last name of the user.
22+
- `username` (String) The user name. This needs to be a valid email. User will be replaced upon username change.
23+
24+
### Optional
25+
26+
- `role` (String) The user role.
27+
28+
### Read-Only
29+
30+
- `id` (String) The user id.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "passbolt_user" "dummy" {
2+
username = "dummy@test.com"
3+
firstname = "Johnny"
4+
lastname = "Test"
5+
role = local.role_admin_id
6+
}
7+
8+
data "passbolt_roles" "all" {}
9+
10+
output "out" {
11+
value = data.passbolt_roles.all.roles
12+
}
13+
14+
locals {
15+
role_admin_id = one([for item in data.passbolt_roles.all.roles : item if item.name == "admin"]).id
16+
role_user_id = one([for item in data.passbolt_roles.all.roles : item if item.name == "user"]).id
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "passbolt_group" "grp" {
2+
name = "devops-team"
3+
4+
group_users = [
5+
{
6+
user_id = "5f8642a0-f3e3-403b-b666-8cda965fbad6"
7+
is_admin = true
8+
},
9+
]
10+
}

0 commit comments

Comments
 (0)