- Notifications
You must be signed in to change notification settings - Fork4
feat: addcoderd_organization_group_sync
resource#248
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -56,7 +56,9 @@ resource "coderd_organization" "blueberry" { | ||
- `description` (String) | ||
- `display_name` (String) Display name of the organization. Defaults to name. | ||
- `group_sync` (Block, Optional, Deprecated) Group sync settings to sync groups from an IdP. | ||
~> **Deprecated** This block is deprecated. Use the `coderd_organization_group_sync` resource instead. (see [below for nested schema](#nestedblock--group_sync)) | ||
ethanndickson marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
- `icon` (String) | ||
- `org_sync_idp_groups` (Set of String) Claims from the IdP provider that will give users access to this organization. | ||
- `role_sync` (Block, Optional) Role sync settings to sync organization roles from an IdP. (see [below for nested schema](#nestedblock--role_sync)) | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "coderd_organization_group_sync Resource - terraform-provider-coderd" | ||
subcategory: "" | ||
description: |- | ||
Group sync settings for an organization on the Coder deployment. | ||
Multiple instances of this resource for a single organization will conflict. | ||
~> Warning | ||
This resource is only compatible with Coder version 2.16.0 https://github.com/coder/coder/releases/tag/v2.16.0 and later. | ||
--- | ||
# coderd_organization_group_sync (Resource) | ||
Group sync settings for an organization on the Coder deployment. | ||
Multiple instances of this resource for a single organization will conflict. | ||
~> **Warning** | ||
This resource is only compatible with Coder version [2.16.0](https://github.com/coder/coder/releases/tag/v2.16.0) and later. | ||
## Example Usage | ||
```terraform | ||
resource "coderd_organization_group_sync" "test" { | ||
organization_id = coderd_organization.test.id | ||
field = "groups" | ||
regex_filter = "test_.*|admin_.*" | ||
auto_create_missing = false | ||
mapping = { | ||
"test_developers" = [coderd_group.test.id] | ||
"admin_users" = [coderd_group.admins.id] | ||
"mixed_group" = [coderd_group.test.id, coderd_group.admins.id] | ||
} | ||
} | ||
``` | ||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
### Required | ||
- `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. | ||
- `organization_id` (String) The ID of the organization to configure group sync for. | ||
### Optional | ||
- `auto_create_missing` (Boolean) Controls whether groups will be created if they are missing. Defaults to false. | ||
- `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. | ||
## Import | ||
Import is supported using the following syntax: | ||
The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: | ||
```shell | ||
# The ID supplied must be an organization UUID | ||
$ terraform import coderd_organization_group_sync.main_group_sync <org-id> | ||
``` | ||
Alternatively, in Terraform v1.5.0 and later, an [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used: | ||
```terraform | ||
import { | ||
to = coderd_organization_group_sync.main_group_sync | ||
id = "<org-id>" | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# The ID supplied must be an organization UUID | ||
$ terraform import coderd_organization_group_sync.main_group_sync <org-id> | ||
``` | ||
Alternatively, in Terraform v1.5.0 and later, an [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used: | ||
```terraform | ||
import { | ||
to = coderd_organization_group_sync.main_group_sync | ||
id = "<org-id>" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "coderd_organization_group_sync" "test" { | ||
organization_id = coderd_organization.test.id | ||
field = "groups" | ||
regex_filter = "test_.*|admin_.*" | ||
auto_create_missing = false | ||
mapping = { | ||
"test_developers" = [coderd_group.test.id] | ||
"admin_users" = [coderd_group.admins.id] | ||
"mixed_group" = [coderd_group.test.id, coderd_group.admins.id] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
terraform { | ||
required_providers { | ||
coderd = { | ||
source = "coder/coderd" | ||
version = ">=0.0.0" | ||
} | ||
} | ||
} | ||
resource "coderd_organization" "test" { | ||
name = "test-org-group-sync" | ||
display_name = "Test Organization for Group Sync" | ||
description = "Organization created for testing group sync functionality" | ||
} | ||
resource "coderd_group" "test" { | ||
organization_id = coderd_organization.test.id | ||
name = "test-group" | ||
display_name = "Test Group" | ||
quota_allowance = 50 | ||
} | ||
resource "coderd_group" "admins" { | ||
organization_id = coderd_organization.test.id | ||
name = "admin-group" | ||
display_name = "Admin Group" | ||
quota_allowance = 100 | ||
} | ||
resource "coderd_organization_group_sync" "test" { | ||
organization_id = coderd_organization.test.id | ||
field = "groups" | ||
regex_filter = "test_.*|admin_.*" | ||
auto_create_missing = false | ||
mapping = { | ||
"test_developers" = [coderd_group.test.id] | ||
"admin_users" = [coderd_group.admins.id] | ||
"mixed_group" = [coderd_group.test.id, coderd_group.admins.id] | ||
} | ||
} | ||
data "coderd_organization" "test_data" { | ||
id = coderd_organization.test.id | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -7,7 +7,7 @@ import ( | ||
) | ||
func checkRegexp(it string) error { | ||
_, err := regexp.Compile(it) | ||
return err | ||
CopilotAI | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.