Skip to content

Commit

Permalink
Update docs for team data source
Browse files Browse the repository at this point in the history
  • Loading branch information
jradtilbrook committed Sep 11, 2023
1 parent cccead7 commit 5e18d2a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
12 changes: 8 additions & 4 deletions buildkite/data_source_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -46,10 +47,13 @@ func (t *teamDatasource) Metadata(ctx context.Context, req datasource.MetadataRe

func (t *teamDatasource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: "This datasource allows you to get a team from Buildkite.",
MarkdownDescription: heredoc.Doc(`
Use this data source to retrieve a team by slug or id. You can find out more about clusters in the Buildkite
[documentation](https://buildkite.com/docs/pipelines/permissions).
`),
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "The ID of the team.",
MarkdownDescription: "The ID of the team to find. Use either ID or slug.",
Optional: true,
Computed: true,
Validators: []validator.String{
Expand All @@ -64,7 +68,7 @@ func (t *teamDatasource) Schema(ctx context.Context, req datasource.SchemaReques
Computed: true,
},
"slug": schema.StringAttribute{
MarkdownDescription: "The slug of the team.",
MarkdownDescription: "The slug of the team to find. Use either ID or slug.",
Computed: true,
Optional: true,
},
Expand All @@ -73,7 +77,7 @@ func (t *teamDatasource) Schema(ctx context.Context, req datasource.SchemaReques
Computed: true,
},
"privacy": schema.StringAttribute{
MarkdownDescription: "The privacy of the team.",
MarkdownDescription: "The privacy setting of the team.",
Computed: true,
},
"description": schema.StringAttribute{
Expand Down
49 changes: 27 additions & 22 deletions docs/data-sources/team.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
# Data Source: team
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "buildkite_team Data Source - terraform-provider-buildkite"
subcategory: ""
description: |-
Use this data source to retrieve a team by slug or id. You can find out more about clusters in the Buildkite
documentation https://buildkite.com/docs/pipelines/permissions.
---

Use this data source to look up properties of a team. This can be used to
validate that a team exists before setting the team slug on a pipeline.
# buildkite_team (Data Source)

Buildkite documentation: https://buildkite.com/docs/pipelines/permissions
Use this data source to retrieve a team by slug or id. You can find out more about clusters in the Buildkite
[documentation](https://buildkite.com/docs/pipelines/permissions).

## Example Usage

```hcl
data "buildkite_team" "my_team_data" {
id = "<team id>"
```terraform
data "buildkite_team" "team" {
id = "Everyone"
}
```

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

One of:
* `id` - The GraphQL ID of the team, available in the Settings page for the team.
* `slug` - The slug of the team. Available in the URL of the team on buildkite.com; in the format
"<organizaton/team-name>"
### Optional

The `team` data-source supports **either** the use of `id` or `slug` for lookup of a team.
- `id` (String) The ID of the team to find. Use either ID or slug.
- `slug` (String) The slug of the team to find. Use either ID or slug.

## Attribute Reference
### Read-Only

* `id` - The GraphQL ID of the team
* `uuid` - The UUID of the team
* `name` - The name of the team
* `privacy` - Whether the team is visible to org members outside this team
* `description` - A description of the team
* `default_team` - Whether new org members will be automatically added to this team
* `default_member_role` - Default role to assign to a team member
* `members_can_create_pipelines` - Whether team members can create new pipelines and add them to the team
- `default_member_role` (String) The default member role of the team.
- `default_team` (Boolean) Whether the team is the default team.
- `description` (String) The description of the team.
- `members_can_create_pipelines` (Boolean) Whether members can create pipelines.
- `name` (String) The name of the team.
- `privacy` (String) The privacy setting of the team.
- `uuid` (String) The UUID of the team.
3 changes: 3 additions & 0 deletions examples/data-sources/buildkite_team/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "buildkite_team" "team" {
id = "Everyone"
}

0 comments on commit 5e18d2a

Please sign in to comment.