Skip to content

Commit

Permalink
Merge pull request #6 from enthought/add-team-resource
Browse files Browse the repository at this point in the history
Add organization team and robot resources
  • Loading branch information
ddebeau authored Aug 19, 2024
2 parents ecdaff1 + 5c995d8 commit 0640af2
Show file tree
Hide file tree
Showing 24 changed files with 1,824 additions and 249 deletions.
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

0 comments on commit 0640af2

Please sign in to comment.