Skip to content

Commit 880f56d

Browse files
authored
Merge pull request #8 from enthought/add-permissions
Add organization team permission resource and data source
2 parents 0f83332 + 633cd74 commit 880f56d

File tree

17 files changed

+1016
-44
lines changed

17 files changed

+1016
-44
lines changed

code_generator/provider_code_spec.json

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
"name": "role",
165165
"string": {
166166
"computed_optional_required": "required",
167-
"description": "Team permission. Should be admin, creator, or member.",
167+
"description": "Team role. Should be admin, creator, or member.",
168168
"validators": [
169169
{
170170
"custom": {
@@ -182,6 +182,89 @@
182182
]
183183
}
184184
},
185+
{
186+
"name": "organization_team_permission",
187+
"schema": {
188+
"attributes": [
189+
{
190+
"name": "orgname",
191+
"string": {
192+
"computed_optional_required": "required",
193+
"description": "Organization name",
194+
"plan_modifiers": [
195+
{
196+
"custom": {
197+
"imports": [
198+
{
199+
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
200+
}
201+
],
202+
"schema_definition": "stringplanmodifier.RequiresReplace()"
203+
}
204+
}
205+
]
206+
}
207+
},
208+
{
209+
"name": "reponame",
210+
"string": {
211+
"computed_optional_required": "required",
212+
"description": "Repository name",
213+
"plan_modifiers": [
214+
{
215+
"custom": {
216+
"imports": [
217+
{
218+
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
219+
}
220+
],
221+
"schema_definition": "stringplanmodifier.RequiresReplace()"
222+
}
223+
}
224+
]
225+
}
226+
},
227+
{
228+
"name": "teamname",
229+
"string": {
230+
"computed_optional_required": "required",
231+
"description": "Team name",
232+
"plan_modifiers": [
233+
{
234+
"custom": {
235+
"imports": [
236+
{
237+
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
238+
}
239+
],
240+
"schema_definition": "stringplanmodifier.RequiresReplace()"
241+
}
242+
}
243+
]
244+
}
245+
},
246+
{
247+
"name": "permission",
248+
"string": {
249+
"computed_optional_required": "required",
250+
"description": "Team permission. Should be read, write or admin.",
251+
"validators": [
252+
{
253+
"custom": {
254+
"imports": [
255+
{
256+
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
257+
}
258+
],
259+
"schema_definition": "stringvalidator.OneOf([]string{\"read\", \"write\", \"admin\"}...)"
260+
}
261+
}
262+
]
263+
}
264+
}
265+
]
266+
}
267+
},
185268
{
186269
"name": "repository",
187270
"schema": {
@@ -282,6 +365,41 @@
282365
]
283366
}
284367
},
368+
{
369+
"name": "organization_team_permission",
370+
"schema": {
371+
"attributes": [
372+
{
373+
"name": "orgname",
374+
"string": {
375+
"computed_optional_required": "required",
376+
"description": "Organization name"
377+
}
378+
},
379+
{
380+
"name": "reponame",
381+
"string": {
382+
"computed_optional_required": "required",
383+
"description": "Repository name"
384+
}
385+
},
386+
{
387+
"name": "teamname",
388+
"string": {
389+
"computed_optional_required": "required",
390+
"description": "Team name"
391+
}
392+
},
393+
{
394+
"name": "permission",
395+
"string": {
396+
"computed_optional_required": "computed",
397+
"description": "Team permission"
398+
}
399+
}
400+
]
401+
}
402+
},
285403
{
286404
"name": "repository",
287405
"schema": {
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "quay_organization_team_permission Data Source - quay"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# quay_organization_team_permission (Data Source)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "quay_organization" "org" {
17+
name = "org"
18+
19+
}
20+
21+
resource "quay_repository" "repo" {
22+
name = "repo"
23+
namespace = quay_organization.org.name
24+
}
25+
26+
resource "quay_organization_team" "team" {
27+
name = "team"
28+
orgname = quay_organization.org.name
29+
role = "member"
30+
}
31+
32+
data "quay_organization_team_permission" "permission" {
33+
orgname = quay_organization.org.name
34+
reponame = quay_repository.repo.name
35+
teamname = quay_organization_team.team.name
36+
}
37+
```
38+
39+
<!-- schema generated by tfplugindocs -->
40+
## Schema
41+
42+
### Required
43+
44+
- `orgname` (String) Organization name
45+
- `reponame` (String) Repository name
46+
- `teamname` (String) Team name
47+
48+
### Read-Only
49+
50+
- `permission` (String) Team permission

docs/resources/organization_team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "quay_organization_team" "admin" {
4040

4141
- `name` (String) Team name
4242
- `orgname` (String) Organization name
43-
- `role` (String) Team permission. Should be admin, creator, or member.
43+
- `role` (String) Team role. Should be admin, creator, or member.
4444

4545
### Optional
4646

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "quay_organization_team_permission Resource - quay"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# quay_organization_team_permission (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "quay_organization" "org" {
17+
name = "org"
18+
19+
}
20+
21+
resource "quay_repository" "repo" {
22+
name = "repo"
23+
namespace = quay_organization.org.name
24+
}
25+
26+
resource "quay_organization_team" "team" {
27+
name = "team"
28+
orgname = quay_organization.org.name
29+
role = "member"
30+
}
31+
32+
resource "quay_organization_team_permission" "permission" {
33+
orgname = quay_organization.org.name
34+
reponame = quay_repository.repo.name
35+
teamname = quay_organization_team.team.name
36+
permission = "read"
37+
}
38+
```
39+
40+
<!-- schema generated by tfplugindocs -->
41+
## Schema
42+
43+
### Required
44+
45+
- `orgname` (String) Organization name
46+
- `permission` (String) Team permission. Should be read, write or admin.
47+
- `reponame` (String) Repository name
48+
- `teamname` (String) Team name
49+
50+
## Import
51+
52+
Import is supported using the following syntax:
53+
54+
```shell
55+
# An organization team permission can be imported using the corresponding organization, repository and team name.
56+
terraform import quay_organization_team_permission.permission org repo team
57+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
resource "quay_organization" "org" {
2+
name = "org"
3+
4+
}
5+
6+
resource "quay_repository" "repo" {
7+
name = "repo"
8+
namespace = quay_organization.org.name
9+
}
10+
11+
resource "quay_organization_team" "team" {
12+
name = "team"
13+
orgname = quay_organization.org.name
14+
role = "member"
15+
}
16+
17+
data "quay_organization_team_permission" "permission" {
18+
orgname = quay_organization.org.name
19+
reponame = quay_repository.repo.name
20+
teamname = quay_organization_team.team.name
21+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# An organization team permission can be imported using the corresponding organization, repository and team name.
2+
terraform import quay_organization_team_permission.permission org repo team
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
resource "quay_organization" "org" {
2+
name = "org"
3+
4+
}
5+
6+
resource "quay_repository" "repo" {
7+
name = "repo"
8+
namespace = quay_organization.org.name
9+
}
10+
11+
resource "quay_organization_team" "team" {
12+
name = "team"
13+
orgname = quay_organization.org.name
14+
role = "member"
15+
}
16+
17+
resource "quay_organization_team_permission" "permission" {
18+
orgname = quay_organization.org.name
19+
reponame = quay_repository.repo.name
20+
teamname = quay_organization_team.team.name
21+
permission = "read"
22+
}

internal/datasource_organization_team_permission/organization_team_permission_data_source_gen.go

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)