Skip to content

feat: add organization custom property resource #2661

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oscarbc96
Copy link

Resolves #ISSUE_NUMBER


Before the change?

  • The github_organization_custom_property resource did not exist.
  • There was no way to manage GitHub organization-level custom properties via Terraform.

After the change?

  • Added a new github_organization_custom_property resource.
  • Supports defining name, type, allowed values, default value, requirement status, and edit permissions.
  • Includes full validation logic using CustomizeDiff to ensure consistent and correct configurations.
  • Supports custom marshaling to allow default_value to be a string, list, or null depending on the property type.
  • A full test suite was added to validate all logic paths and prevent invalid configurations.

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)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

tcosta-travelperk
tcosta-travelperk approved these changes May 16, 2025
@oscarbc96 oscarbc96 changed the title add organization custom property resource feat: add organization custom property resource May 16, 2025
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubOrganizationCustomProperty_CustomizeDiff_Validations(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you run these tests? They do not pass for me. Example errors:

        Error: default_value must contain zero or one item when type is SINGLE_SELECT or STRING
        
          with github_organization_custom_property.test,
          on terraform_plugin_test.tf line 3, in resource "github_organization_custom_property" "test":
           3: resource "github_organization_custom_property" "test" {
        Error: default_value must be a subset of allowed_values
        
          with github_organization_custom_property.test,
          on terraform_plugin_test.tf line 3, in resource "github_organization_custom_property" "test":
           3: resource "github_organization_custom_property" "test" {
  | Error: default_value must be either "true" or "false" when type is TRUE_FALSE
  | 
  |   with github_organization_custom_property.test,
  |   on terraform_plugin_test.tf line 3, in resource "github_organization_custom_property" "test":
  |    3: resource "github_organization_custom_property" "test" {
  | 

@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants