Skip to content

Commit

Permalink
Merge pull request #8 from enthought/add-permissions
Browse files Browse the repository at this point in the history
Add organization team permission resource and data source
  • Loading branch information
ddebeau authored Aug 28, 2024
2 parents 0f83332 + 633cd74 commit 880f56d
Show file tree
Hide file tree
Showing 17 changed files with 1,016 additions and 44 deletions.
120 changes: 119 additions & 1 deletion code_generator/provider_code_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"name": "role",
"string": {
"computed_optional_required": "required",
"description": "Team permission. Should be admin, creator, or member.",
"description": "Team role. Should be admin, creator, or member.",
"validators": [
{
"custom": {
Expand All @@ -182,6 +182,89 @@
]
}
},
{
"name": "organization_team_permission",
"schema": {
"attributes": [
{
"name": "orgname",
"string": {
"computed_optional_required": "required",
"description": "Organization name",
"plan_modifiers": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
}
],
"schema_definition": "stringplanmodifier.RequiresReplace()"
}
}
]
}
},
{
"name": "reponame",
"string": {
"computed_optional_required": "required",
"description": "Repository name",
"plan_modifiers": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
}
],
"schema_definition": "stringplanmodifier.RequiresReplace()"
}
}
]
}
},
{
"name": "teamname",
"string": {
"computed_optional_required": "required",
"description": "Team name",
"plan_modifiers": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
}
],
"schema_definition": "stringplanmodifier.RequiresReplace()"
}
}
]
}
},
{
"name": "permission",
"string": {
"computed_optional_required": "required",
"description": "Team permission. Should be read, write or admin.",
"validators": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.OneOf([]string{\"read\", \"write\", \"admin\"}...)"
}
}
]
}
}
]
}
},
{
"name": "repository",
"schema": {
Expand Down Expand Up @@ -282,6 +365,41 @@
]
}
},
{
"name": "organization_team_permission",
"schema": {
"attributes": [
{
"name": "orgname",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
},
{
"name": "reponame",
"string": {
"computed_optional_required": "required",
"description": "Repository name"
}
},
{
"name": "teamname",
"string": {
"computed_optional_required": "required",
"description": "Team name"
}
},
{
"name": "permission",
"string": {
"computed_optional_required": "computed",
"description": "Team permission"
}
}
]
}
},
{
"name": "repository",
"schema": {
Expand Down
50 changes: 50 additions & 0 deletions docs/data-sources/organization_team_permission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "quay_organization_team_permission Data Source - quay"
subcategory: ""
description: |-
---

# quay_organization_team_permission (Data Source)



## Example Usage

```terraform
resource "quay_organization" "org" {
name = "org"
email = "[email protected]"
}
resource "quay_repository" "repo" {
name = "repo"
namespace = quay_organization.org.name
}
resource "quay_organization_team" "team" {
name = "team"
orgname = quay_organization.org.name
role = "member"
}
data "quay_organization_team_permission" "permission" {
orgname = quay_organization.org.name
reponame = quay_repository.repo.name
teamname = quay_organization_team.team.name
}
```

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

### Required

- `orgname` (String) Organization name
- `reponame` (String) Repository name
- `teamname` (String) Team name

### Read-Only

- `permission` (String) Team permission
2 changes: 1 addition & 1 deletion docs/resources/organization_team.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ resource "quay_organization_team" "admin" {

- `name` (String) Team name
- `orgname` (String) Organization name
- `role` (String) Team permission. Should be admin, creator, or member.
- `role` (String) Team role. Should be admin, creator, or member.

### Optional

Expand Down
57 changes: 57 additions & 0 deletions docs/resources/organization_team_permission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "quay_organization_team_permission Resource - quay"
subcategory: ""
description: |-
---

# quay_organization_team_permission (Resource)



## Example Usage

```terraform
resource "quay_organization" "org" {
name = "org"
email = "[email protected]"
}
resource "quay_repository" "repo" {
name = "repo"
namespace = quay_organization.org.name
}
resource "quay_organization_team" "team" {
name = "team"
orgname = quay_organization.org.name
role = "member"
}
resource "quay_organization_team_permission" "permission" {
orgname = quay_organization.org.name
reponame = quay_repository.repo.name
teamname = quay_organization_team.team.name
permission = "read"
}
```

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

### Required

- `orgname` (String) Organization name
- `permission` (String) Team permission. Should be read, write or admin.
- `reponame` (String) Repository name
- `teamname` (String) Team name

## Import

Import is supported using the following syntax:

```shell
# An organization team permission can be imported using the corresponding organization, repository and team name.
terraform import quay_organization_team_permission.permission org repo team
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "quay_organization" "org" {
name = "org"
email = "[email protected]"
}

resource "quay_repository" "repo" {
name = "repo"
namespace = quay_organization.org.name
}

resource "quay_organization_team" "team" {
name = "team"
orgname = quay_organization.org.name
role = "member"
}

data "quay_organization_team_permission" "permission" {
orgname = quay_organization.org.name
reponame = quay_repository.repo.name
teamname = quay_organization_team.team.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# An organization team permission can be imported using the corresponding organization, repository and team name.
terraform import quay_organization_team_permission.permission org repo team
22 changes: 22 additions & 0 deletions examples/resources/quay_organization_team_permission/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "quay_organization" "org" {
name = "org"
email = "[email protected]"
}

resource "quay_repository" "repo" {
name = "repo"
namespace = quay_organization.org.name
}

resource "quay_organization_team" "team" {
name = "team"
orgname = quay_organization.org.name
role = "member"
}

resource "quay_organization_team_permission" "permission" {
orgname = quay_organization.org.name
reponame = quay_repository.repo.name
teamname = quay_organization_team.team.name
permission = "read"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 880f56d

Please sign in to comment.