Skip to content

Commit

Permalink
feat: add coderd_group resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanndickson committed Jul 18, 2024
1 parent 375a205 commit f555328
Show file tree
Hide file tree
Showing 10 changed files with 645 additions and 80 deletions.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ provider "coderd" {

### Optional

- `default_organization_id` (String) Default organization ID to use when creating resources. Defaults to the first organization the token has access to.
- `token` (String) API token for communicating with the deployment. Most resource types require elevated permissions. Defaults to $CODER_SESSION_TOKEN.
- `url` (String) URL to the Coder deployment. Defaults to $CODER_URL.
32 changes: 32 additions & 0 deletions docs/resources/group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "coderd_group Resource - coderd"
subcategory: ""
description: |-
A group on the Coder deployment. If you want to have a group resource with unmanaged members, but still want to read the members in Terraform, use the data.coderd_group data source.
---

# coderd_group (Resource)

A group on the Coder deployment. If you want to have a group resource with unmanaged members, but still want to read the members in Terraform, use the `data.coderd_group` data source.



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

### Required

- `name` (String) The unique name of the group.

### Optional

- `avatar_url` (String) The URL of the group's avatar.
- `display_name` (String) The display name of the group. Defaults to the group name.
- `members` (Set of String) Members of the group, by ID. If null, members will not be added or removed.
- `organization_id` (String) The organization ID that the group belongs to. Defaults to the provider default organization ID.
- `quota_allowance` (Number) The number of quota credits to allocate to each user in the group.

### Read-Only

- `id` (String) Group ID.
7 changes: 4 additions & 3 deletions integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/stretchr/testify/require"
)

func StartCoder(ctx context.Context, t *testing.T, name string) *codersdk.Client {
func StartCoder(ctx context.Context, t *testing.T, name string, useTrial bool) *codersdk.Client {
coderImg := os.Getenv("CODER_IMAGE")
if coderImg == "" {
coderImg = "ghcr.io/coder/coder"
Expand Down Expand Up @@ -75,9 +75,9 @@ func StartCoder(ctx context.Context, t *testing.T, name string) *codersdk.Client

// nolint:gosec // For testing only.
var (
testEmail = "testing@coder.com"
testEmail = "admin@coder.com"
testPassword = "InsecurePassw0rd!"
testUsername = "testing"
testUsername = "admin"
)

// Perform first time setup
Expand All @@ -96,6 +96,7 @@ func StartCoder(ctx context.Context, t *testing.T, name string) *codersdk.Client
Email: testEmail,
Username: testUsername,
Password: testPassword,
Trial: useTrial,
})
require.NoError(t, err, "create first user")
resp, err := client.LoginWithPassword(ctx, codersdk.LoginWithPasswordRequest{
Expand Down
2 changes: 1 addition & 1 deletion integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestIntegration(t *testing.T) {
},
} {
t.Run(tt.name, func(t *testing.T) {
client := StartCoder(ctx, t, tt.name)
client := StartCoder(ctx, t, tt.name, true)
wd, err := os.Getwd()
require.NoError(t, err)
srcDir := filepath.Join(wd, tt.name)
Expand Down
Loading

0 comments on commit f555328

Please sign in to comment.