Skip to content

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
Contributor

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
@github-actions github-actions bot added the Type: Feature New feature or request label Nov 26, 2025
@deiga
Copy link
Contributor

deiga commented Nov 26, 2025

@nickfloyd I think this might be a duplicate of: https://github.com/integrations/terraform-provider-github/blob/main/github/resource_github_organization_custom_properties.go

@nickfloyd
Copy link
Member

@nickfloyd I think this might be a duplicate of: https://github.com/integrations/terraform-provider-github/blob/main/github/resource_github_organization_custom_properties.go

@deiga It looks like you're correct. It's unfortunate that the implemented one uses the plural naming scheme. The general pattern has been to use plural on collections and singular on single resource operations.

For instance, repository collaborators (single, collection) implements this approach.

I missed this one because we already had a plural named - single implementation 😬. Thats another thing that needs documentation - how to properly handle single operations verses plural ones.

I'm closing this and have added an issue to address this.

@oscarbc96 if you feel like this has been closed in error please @ me here an we can discuss. Thank you for the work you put in here.

@nickfloyd nickfloyd closed this Nov 26, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in 🧰 Octokit Active Nov 26, 2025
@nickfloyd nickfloyd added this to the v6.x version wrap up milestone Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants