Skip to content

Commit

Permalink
feat: add group_sync and role_sync for `coderd_organization_resou…
Browse files Browse the repository at this point in the history
…rce` (#147)
  • Loading branch information
aslilac authored Dec 3, 2024
1 parent dedb7d0 commit 283e3cc
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/resources/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,33 @@ An organization on the Coder deployment

- `description` (String)
- `display_name` (String) Display name of the organization. Defaults to name.
- `group_sync` (Block, Optional) (see [below for nested schema](#nestedblock--group_sync))
- `icon` (String)
- `role_sync` (Block, Optional) (see [below for nested schema](#nestedblock--role_sync))

### Read-Only

- `id` (String) Organization ID

<a id="nestedblock--group_sync"></a>
### Nested Schema for `group_sync`

Optional:

- `auto_create_missing` (Boolean) Controls whether groups will be created if they are missing.
- `field` (String) The claim field that specifies what groups a user should be in.
- `mapping` (Map of List of String) A map from OIDC group name to Coder group ID.
- `regex_filter` (String) A regular expression that will be used to filter the groups returned by the OIDC provider. Any group not matched will be ignored.


<a id="nestedblock--role_sync"></a>
### Nested Schema for `role_sync`

Optional:

- `field` (String) The claim field that specifies what organization roles a user should be given.
- `mapping` (Map of List of String) A map from OIDC group name to Coder organization role.

## Import

Import is supported using the following syntax:
Expand Down
16 changes: 16 additions & 0 deletions internal/codersdkvalidator/regex.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package codersdkvalidator

import (
"regexp"

"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

func checkRegexp(it string) error {
_, err := regexp.Compile("")
return err
}

func Regexp() validator.String {
return validatorFromFunc(checkRegexp, "value must be a valid regexp")
}
Loading

0 comments on commit 283e3cc

Please sign in to comment.