Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add organization team and robot resources #6

Merged
merged 30 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f113588
Create test for UpdateOrganizationTeam
ddebeau Aug 12, 2024
fce4a8d
Create test for GetOrganizationTeamPermissions
ddebeau Aug 12, 2024
12b0352
Create test for DeleteOrganizationTeam
ddebeau Aug 12, 2024
67dcf89
Handle Quay API errors
ddebeau Aug 12, 2024
b81a701
Create test for UpdateOrganizationTeamMember
ddebeau Aug 12, 2024
da12902
Create test for GetOrganizationTeamMembers
ddebeau Aug 13, 2024
392a8c5
Create test for DeleteOrganizationTeamMember
ddebeau Aug 13, 2024
e064972
Add TeamResourceSchema
ddebeau Aug 13, 2024
b708e86
Set team role to required
ddebeau Aug 15, 2024
659e31a
Set Team description to optional and computed, and set a default value
ddebeau Aug 15, 2024
4670026
Add Create and Read methods for Team resource
ddebeau Aug 15, 2024
097110f
Require the team to be replaced on certain attribute changes
ddebeau Aug 15, 2024
6057c26
Add Update method for Team resource
ddebeau Aug 16, 2024
77b4c17
Use handleQuayAPIError function
ddebeau Aug 16, 2024
821da06
Create basic tests for OrgRobot
ddebeau Aug 16, 2024
ea320c4
Add OrganizationRobot resource
ddebeau Aug 16, 2024
1267785
Add Import method for OrganizationRobot resource
ddebeau Aug 16, 2024
f11aebd
Add Import method for Team resource
ddebeau Aug 16, 2024
a1f36b7
Rename quay_team to quay_organization_team
ddebeau Aug 16, 2024
10773ae
Add support for adding team members to OrganizationTeam
ddebeau Aug 16, 2024
6eeab0c
Split OrganizationTeam test
ddebeau Aug 19, 2024
83a558b
Parallelize OrganizationTeam tests
ddebeau Aug 19, 2024
4a5abff
Parallelize OrganizationRobot test
ddebeau Aug 19, 2024
c053209
Parallelize Organization test
ddebeau Aug 19, 2024
718bf12
Parallelize Organization data source test
ddebeau Aug 19, 2024
d7f734f
Handle case where members list is empty
ddebeau Aug 19, 2024
dfc6b3b
Make code easier to read
ddebeau Aug 19, 2024
b497715
Consolidate OrganizationTeam tests
ddebeau Aug 19, 2024
d0fb60c
Update docs
ddebeau Aug 19, 2024
5c995d8
Fix lint error
ddebeau Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 208 additions & 50 deletions code_generator/provider_code_spec.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,210 @@
{
"provider": {
"name": "quay"
},
"resources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "required",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
}
],
"datasources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "computed",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
}
],
"version": "0.1"
"provider": {
"name": "quay"
},
"resources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "required",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
},
{
"name": "organization_robot",
"schema": {
"attributes": [
{
"name": "description",
"string": {
"computed_optional_required": "computed_optional",
"default" : {
"static": ""
},
"description": "Text description",
"plan_modifiers": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
}
],
"schema_definition": "stringplanmodifier.RequiresReplace()"
}
}
]
}
},
{
"name": "fullname",
"string": {
"computed_optional_required": "computed",
"description": "Robot full name"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Robot short name",
"plan_modifiers": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
}
],
"schema_definition": "stringplanmodifier.RequiresReplace()"
}
}
]
}
},
{
"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": "organization_team",
"schema": {
"attributes": [
{
"name": "description",
"string": {
"computed_optional_required": "computed_optional",
"default" : {
"static": ""
},
"description": "Markdown description"
}
},
{
"name": "members",
"list": {
"computed_optional_required": "optional",
"description": "List of team members",
"element_type": {
"string": {}
}
}
},
{
"name": "name",
"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": "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": "role",
"string": {
"computed_optional_required": "required",
"description": "Team permission. Should be admin, creator, or member.",
"validators": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.OneOf([]string{\"admin\", \"creator\", \"member\"}...)"
}
}
]
}
}
]
}
}
],
"datasources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "computed",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
}
],
"version": "0.1"
}
50 changes: 50 additions & 0 deletions docs/resources/organization_robot.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_robot Resource - quay"
subcategory: ""
description: |-

---

# quay_organization_robot (Resource)



## Example Usage

```terraform
resource "quay_organization" "main" {
name = "main"
email = "[email protected]"
}

resource "quay_organization_robot" "test" {
name = "test"
orgname = quay_organization.main.name
}
```

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

### Required

- `name` (String) Robot short name
- `orgname` (String) Organization name

### Optional

- `description` (String) Text description

### Read-Only

- `fullname` (String) Robot full name

## Import

Import is supported using the following syntax:

```shell
# An organization robot can be imported using its short name.
terraform import quay_organization_robot.test test
```
57 changes: 57 additions & 0 deletions docs/resources/organization_team.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 Resource - quay"
subcategory: ""
description: |-

---

# quay_organization_team (Resource)



## Example Usage

```terraform
resource "quay_organization" "main" {
name = "main"
email = "[email protected]"
}

resource "quay_organization_robot" "test" {
name = "test"
orgname = quay_organization.main.name
}

resource "quay_organization_team" "admin" {
name = "admin"
orgname = quay_organization.main.name
role = "admin"
members = [
quay_organization_robot.test.fullname
]
}
```

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

### Required

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

### Optional

- `description` (String) Markdown description
- `members` (List of String) List of team members

## Import

Import is supported using the following syntax:

```shell
# An organization team can be imported using its name.
terraform import quay_organization_team.admin admin
```
14 changes: 14 additions & 0 deletions examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ resource "quay_organization" "main" {
name = "main"
email = "[email protected]"
}

resource "quay_organization_robot" "test" {
name = "test"
orgname = quay_organization.main.name
}

resource "quay_organization_team" "admin" {
name = "admin"
orgname = quay_organization.main.name
role = "admin"
members = [
quay_organization_robot.test.fullname
]
}
2 changes: 2 additions & 0 deletions examples/resources/quay_organization_robot/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# An organization robot can be imported using its short name.
terraform import quay_organization_robot.test test
Loading