feat: Add GitHub Organization Custom Role Resource and Data Source#1700
feat: Add GitHub Organization Custom Role Resource and Data Source#1700kfcampbell merged 8 commits intointegrations:mainfrom
Conversation
This commit adds a new Terraform resource for creating, reading, updating and deleting GitHub organization custom roles. The `resourceGithubOrganizationCustomRole` function is added to the `github/provider.go` file. The function creates a new schema with four fields: name, base_role, permissions and description. It also includes functions for create, read, update and delete operations on the resource. A new data source is also added in this commit that allows users to query an existing custom repository role by its name. The `dataSourceGithubOrganizationCustomRole` function is added to the `github/data_source_github_organization_custom_role.go` file. Finally, a test case is included in the `github/data_source_github_organization_custom_role_test.go` file that tests querying of an existing custom repository role using the newly created data source.
…om Role This commit updates the formatting of the test and resource files for Github Organization Custom Role. It also removes the ForceNew attribute from one of the required fields in the resource file and updates the tests to reflect it.
This commit fixes the arguments for creating an organization custom role.
Updates to the documentation to reflect this change.
kfcampbell
left a comment
There was a problem hiding this comment.
Confirming that the added integration tests are passing for me. Thank you for contributing!
|
Sorry about the delay here; this slipped through the cracks for me somehow. I'll get this merged and released soon! |
| Type: schema.TypeSet, | ||
| Required: true, | ||
| Elem: &schema.Schema{Type: schema.TypeString}, | ||
| MinItems: 1, // At least one permission should be passed. |
There was a problem hiding this comment.
Sorry to comment on an old/merged PR, but is this a necessary constraint? The API permits creation of a repository role without additional permissions, and it makes perfect sense if the role's only purpose is to designate who can bypass a repository ruleset, for example:
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/$ORG/custom-repository-roles \
-f name='rule-breaker' \
-f description='Can bypass repository rulesets' \
-f base_role='read' \
-f "permissions[]" If you can confirm, shall I open another issue (or PR) to correct this? Thanks!
There was a problem hiding this comment.
I believe you may be right about this. I was however unable to get it to post to the API at the time, so I was thinking it did require something, but I may have just passed in the wrong blank value.
…ntegrations#1700) * feat: Add GitHub organization custom role resource This commit adds a new Terraform resource for creating, reading, updating and deleting GitHub organization custom roles. The `resourceGithubOrganizationCustomRole` function is added to the `github/provider.go` file. The function creates a new schema with four fields: name, base_role, permissions and description. It also includes functions for create, read, update and delete operations on the resource. A new data source is also added in this commit that allows users to query an existing custom repository role by its name. The `dataSourceGithubOrganizationCustomRole` function is added to the `github/data_source_github_organization_custom_role.go` file. Finally, a test case is included in the `github/data_source_github_organization_custom_role_test.go` file that tests querying of an existing custom repository role using the newly created data source. * refactor: Update test and resource files for Github Organization Custom Role This commit updates the formatting of the test and resource files for Github Organization Custom Role. It also removes the ForceNew attribute from one of the required fields in the resource file and updates the tests to reflect it. * docs: Fix arguments for organization custom role This commit fixes the arguments for creating an organization custom role. * docs: Update documentation with organization_custom_role Updates to the documentation to reflect this change. * docs: Fix errant parenthesis * Fix bad merge --------- Co-authored-by: Keegan Campbell <me@kfcampbell.com>
Resolves #1069
Behavior
Before the change?
After the change?
Other information
N/A
Additional info
Pull request checklist
Tests for the changes have been added (for bug fixes / features)
Docs have been reviewed and added / updated if needed (for bug fixes / features)
Added the appropriate label for the given change
Does this introduce a breaking change?
I do not believe so.
Please see our docs on breaking changes to help!
Type: Breaking changelabel)If
Yes, what's the impact:Pull request type
Type: FeatureType: Documentation