Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add group_sync and role_sync for coderd_organization_resource #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading