Skip to content

Commit 7333cb0

Browse files
author
oyeliseiev-ua
committed
PLAT-7450 Add singlestoredb_team resource and datasource
1 parent 215001f commit 7333cb0

File tree

17 files changed

+1411
-0
lines changed

17 files changed

+1411
-0
lines changed

docs/data-sources/team.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "singlestoredb_team Data Source - terraform-provider-singlestoredb"
4+
subcategory: ""
5+
description: |-
6+
Retrieve a specific team using its ID with this data source.
7+
---
8+
9+
# singlestoredb_team (Data Source)
10+
11+
Retrieve a specific team using its ID with this data source.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "singlestoredb" {
17+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
18+
// Please set this environment variable with your SingleStore Management API key.
19+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
20+
}
21+
22+
data "singlestoredb_team" "this" {
23+
id = "24f31e2d-847f-4a62-9a93-a10e9bcd0dae" # Replace with the actual ID of the team.
24+
}
25+
26+
output "this_team" {
27+
value = data.singlestoredb_team.this
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Required
35+
36+
- `id` (String) The unique identifier of the team.
37+
38+
### Read-Only
39+
40+
- `created_at` (String) The timestamp of when the team was created.
41+
- `description` (String) The description of the team.
42+
- `member_teams` (Attributes List) List of teams that are members of this team. (see [below for nested schema](#nestedatt--member_teams))
43+
- `member_users` (Attributes List) List of users that are members of this team. (see [below for nested schema](#nestedatt--member_users))
44+
- `name` (String) The name of the team.
45+
46+
<a id="nestedatt--member_teams"></a>
47+
### Nested Schema for `member_teams`
48+
49+
Read-Only:
50+
51+
- `description` (String) The description of the team.
52+
- `name` (String) The name of the team.
53+
- `team_id` (String) The unique identifier of the team.
54+
55+
56+
<a id="nestedatt--member_users"></a>
57+
### Nested Schema for `member_users`
58+
59+
Read-Only:
60+
61+
- `email` (String) The email of the user.
62+
- `first_name` (String) The first name of the user.
63+
- `last_name` (String) The last name of the user.
64+
- `user_id` (String) The unique identifier of the user.
65+
66+

docs/data-sources/teams.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "singlestoredb_teams Data Source - terraform-provider-singlestoredb"
4+
subcategory: ""
5+
description: |-
6+
This data source provides a list of teams that the user has access to.
7+
---
8+
9+
# singlestoredb_teams (Data Source)
10+
11+
This data source provides a list of teams that the user has access to.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "singlestoredb" {
17+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
18+
// Please set this environment variable with your SingleStore Management API key.
19+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
20+
}
21+
22+
data "singlestoredb_teams" "all" {}
23+
24+
output "all_teams" {
25+
value = data.singlestoredb_teams.all
26+
}
27+
```
28+
29+
<!-- schema generated by tfplugindocs -->
30+
## Schema
31+
32+
### Read-Only
33+
34+
- `id` (String) The ID of this resource.
35+
- `teams` (Attributes List) (see [below for nested schema](#nestedatt--teams))
36+
37+
<a id="nestedatt--teams"></a>
38+
### Nested Schema for `teams`
39+
40+
Required:
41+
42+
- `id` (String) The unique identifier of the team.
43+
44+
Read-Only:
45+
46+
- `created_at` (String) The timestamp of when the team was created.
47+
- `description` (String) The description of the team.
48+
- `member_teams` (Attributes List) List of teams that are members of this team. (see [below for nested schema](#nestedatt--teams--member_teams))
49+
- `member_users` (Attributes List) List of users that are members of this team. (see [below for nested schema](#nestedatt--teams--member_users))
50+
- `name` (String) The name of the team.
51+
52+
<a id="nestedatt--teams--member_teams"></a>
53+
### Nested Schema for `teams.member_teams`
54+
55+
Read-Only:
56+
57+
- `description` (String) The description of the team.
58+
- `name` (String) The name of the team.
59+
- `team_id` (String) The unique identifier of the team.
60+
61+
62+
<a id="nestedatt--teams--member_users"></a>
63+
### Nested Schema for `teams.member_users`
64+
65+
Read-Only:
66+
67+
- `email` (String) The email of the user.
68+
- `first_name` (String) The first name of the user.
69+
- `last_name` (String) The last name of the user.
70+
- `user_id` (String) The unique identifier of the user.
71+
72+

docs/resources/team.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "singlestoredb_team Resource - terraform-provider-singlestoredb"
4+
subcategory: ""
5+
description: |-
6+
Manage SingleStoreDB teams with this resource.
7+
---
8+
9+
# singlestoredb_team (Resource)
10+
11+
Manage SingleStoreDB teams with this resource.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "singlestoredb" {
17+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
18+
// Please set this environment variable with your SingleStore Management API key.
19+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
20+
}
21+
22+
resource "singlestoredb_team" "this" {
23+
name = "terrafrom-test-team"
24+
description = "Terrafrom test team"
25+
member_users = []
26+
member_teams = []
27+
}
28+
29+
output "singlestoredb_team_id" {
30+
value = singlestoredb_team.this.id
31+
}
32+
```
33+
34+
<!-- schema generated by tfplugindocs -->
35+
## Schema
36+
37+
### Required
38+
39+
- `name` (String) The name of the team.
40+
41+
### Optional
42+
43+
- `description` (String) The description of the team.
44+
- `member_teams` (List of String) List of team UUIDs that are members of this team.
45+
- `member_users` (List of String) List of user UUIDs that are members of this team.
46+
47+
### Read-Only
48+
49+
- `created_at` (String) The timestamp of when the team was created.
50+
- `id` (String) The unique identifier of the team.
51+
52+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
provider "singlestoredb" {
2+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
3+
// Please set this environment variable with your SingleStore Management API key.
4+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
5+
}
6+
7+
data "singlestoredb_team" "this" {
8+
id = "24f31e2d-847f-4a62-9a93-a10e9bcd0dae" # Replace with the actual ID of the team.
9+
}
10+
11+
output "this_team" {
12+
value = data.singlestoredb_team.this
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
provider "singlestoredb" {
2+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
3+
// Please set this environment variable with your SingleStore Management API key.
4+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
5+
}
6+
7+
data "singlestoredb_teams" "all" {}
8+
9+
output "all_teams" {
10+
value = data.singlestoredb_teams.all
11+
}

examples/embed.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var (
2020
WorkspacesGetDataSource = mustRead("data-sources/singlestoredb_workspace/data-source.tf")
2121
WorkspaceGroupsResource = mustRead("resources/singlestoredb_workspace_group/resource.tf")
2222
WorkspacesResource = mustRead("resources/singlestoredb_workspace/resource.tf")
23+
TeamsGetDataSource = mustRead("data-sources/singlestoredb_team/data-source.tf")
24+
TeamsResource = mustRead("resources/singlestoredb_team/resource.tf")
25+
TeamsListDataSource = mustRead("data-sources/singlestoredb_teams/data-source.tf")
2326
)
2427

2528
func mustRead(path string) string {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
provider "singlestoredb" {
2+
// The SingleStoreDB Terraform provider uses the SINGLESTOREDB_API_KEY environment variable for authentication.
3+
// Please set this environment variable with your SingleStore Management API key.
4+
// You can generate this key from the SingleStore Portal at https://portal.singlestore.com/organizations/org-id/api-keys.
5+
}
6+
7+
resource "singlestoredb_team" "this" {
8+
name = "terrafrom-test-team"
9+
description = "Terrafrom test team"
10+
member_users = []
11+
member_teams = []
12+
}
13+
14+
output "singlestoredb_team_id" {
15+
value = singlestoredb_team.this.id
16+
}

internal/provider/provider.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/privateconnections"
1818
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/regions"
1919
regions_v2 "github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/regionsv2"
20+
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/teams"
2021
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/util"
2122
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/workspacegroups"
2223
"github.com/singlestore-labs/terraform-provider-singlestoredb/internal/provider/workspaces"
@@ -162,6 +163,8 @@ func (p *singlestoreProvider) DataSources(_ context.Context) []func() datasource
162163
workspaces.NewDataSourceGet,
163164
privateconnections.NewDataSourceList,
164165
privateconnections.NewDataSourceGet,
166+
teams.NewDataSourceList,
167+
teams.NewDataSourceGet,
165168
}
166169
}
167170

@@ -171,6 +174,7 @@ func (p *singlestoreProvider) Resources(_ context.Context) []func() resource.Res
171174
workspacegroups.NewResource,
172175
workspaces.NewResource,
173176
privateconnections.NewResource,
177+
teams.NewResource,
174178
}
175179
}
176180

0 commit comments

Comments
 (0)