Skip to content

Commit

Permalink
Merge pull request #70 from pluralsh/marcin/prod-2930-add-plural_user…
Browse files Browse the repository at this point in the history
…-resource

feat: User resource
  • Loading branch information
maciaszczykm authored Jan 7, 2025
2 parents a82e56c + 711e732 commit 3c796d1
Show file tree
Hide file tree
Showing 9 changed files with 473 additions and 331 deletions.
4 changes: 2 additions & 2 deletions docs/resources/group_member.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ GroupMember resource

### Required

- `group_id` (String) group id for this group member.
- `user_id` (String) user id for this group member.
- `group_id` (String) Group ID for this group member.
- `user_id` (String) User ID for this group member.

### Read-Only

Expand Down
25 changes: 25 additions & 0 deletions docs/resources/user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "plural_user Resource - terraform-provider-plural"
subcategory: ""
description: |-
user resource
---

# plural_user (Resource)

user resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `email` (String) Email address of this user.
- `name` (String) Name of this user.

### Read-Only

- `id` (String) Internal identifier of this user.
53 changes: 34 additions & 19 deletions example/user/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,44 @@ provider "plural" {
use_cli = true
}

data "plural_config" "config" {}
# data "plural_config" "config" {}
#
# data "plural_user" "user" {
# email = "[email protected]"
# }

data "plural_user" "user" {
email = "[email protected]"
resource "plural_user" "spiderman" {
name = "Peter Parker"
email = "[email protected]"
}

data "plural_group" "group" {
name = "team"
# data "plural_group" "avengers" {
# name = "avengers"
# }

resource "plural_group" "avengers" {
name = "avengers"
description = "avengers group"
}

resource "plural_group" "test" {
name = "test"
description = "test group"
resource "plural_group_member" "spiderman" {
user_id = plural_user.spiderman.id
group_id = plural_group.avengers.id
}

resource "plural_rbac" "rbac" {
service_id = "624bff88-05e3-45f6-bc3b-44708594e28e"
bindings = {
read = [{
user_id = data.plural_user.user.id
}]
write = [{
user_id = data.plural_user.user.id
}]
}
}
resource "plural_group_member" "duplicate" {
user_id = plural_user.spiderman.id
group_id = plural_group.avengers.id
}

# resource "plural_rbac" "rbac" {
# service_id = "624bff88-05e3-45f6-bc3b-44708594e28e"
# bindings = {
# read = [{
# user_id = data.plural_user.user.id
# }]
# write = [{
# user_id = data.plural_user.user.id
# }]
# }
# }
Loading

0 comments on commit 3c796d1

Please sign in to comment.