Skip to content

fix(resource_github_organization_custom_properties): support bool default values - #3572

Open
secustor wants to merge 1 commit into
integrations:mainfrom
secustor:fix/custom-attributes
Open

fix(resource_github_organization_custom_properties): support bool default values#3572
secustor wants to merge 1 commit into
integrations:mainfrom
secustor:fix/custom-attributes

Conversation

@secustor

@secustor secustor commented Jul 23, 2026

Copy link
Copy Markdown

This is a minimal fix for users of default values and is intentionally tries not to reach the scope of #3234

Closes: #3580

Resolves infinite drift if when using resource_github_organization_custom_properties of value_type true_false and default_value.

Infinite terraform plan:

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # github_organization_custom_properties.stedisentry_enabled will be updated in-place
  ~ resource "github_organization_custom_properties" "foo" {
      + default_value      = "true"
        id                 = "foo"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Before the change?

customProperty.DefaultValueString() will return "", nill because of https://github.com/google/go-github/blob/a3951f514384b06cc428f394672020c14f7efd84/github/orgs_properties.go#L59

resource "github_organization_custom_properties" "foo" {
  property_name = "foo"
  value_type    = "true_false"
  required      = true

  // currently there is an infinite drift setting creating an addition on each plan 
  default_value = "true" // `true` has the same behavior 
}

This forces following workaround

resource "github_organization_custom_properties" "foo" {
  property_name = "foo"
  value_type    = "true_false"
  required      = true

  default_value = "true"

  lifecycle {
    ignore_changes = [default_value]
  }
}

After the change?

With this instead customProperty.DefaultValueBool() is called and with that the return value is true, nill which will then correctly set in the state

Pull request checklist

  • Schema migrations have been created if needed (example)
  • 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

@github-actions

Copy link
Copy Markdown

👋 Hi, and thank you for this contribution!

This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions.


🤖 This is an automated message.

@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label Jul 23, 2026
@deiga

deiga commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Please mark clearly which issue this is going to resolve!

@secustor

Copy link
Copy Markdown
Author

Resolves infinite drift if when using resource_github_organization_custom_properties of value_type true_false and default_value.

I have been under the impression that the explanation above is clear enough, now there is also an example of the Terraform plan which will be generated on each plan and is not reconciled.

@deiga

deiga commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

@secustor I meant which issue number/URL.
If no issue exists yet, please create one :)

@deiga deiga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the effort so far!

Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: Please use ConfigStateChecks instead

- `description` - (Optional) The description of the custom property.

- `default_value` - (Optional) The default value of the custom property.
- `default_value` - (Optional) The default value of the custom property. Not supported for `multi_select` properties.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please update the Description in the resource as well

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

These provider review instructions are being used.

Fixes perpetual drift for boolean organization custom-property defaults by correctly reading and stringifying boolean API values.

Changes:

  • Handles true_false defaults during state refresh.
  • Adds regression coverage for empty follow-up plans.
  • Documents unsupported multi_select defaults.

Finding: The new test uses legacy assertion APIs instead of ConfigStateChecks.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
github/resource_github_organization_custom_properties.go Reads boolean defaults correctly.
github/resource_github_organization_custom_properties_test.go Adds regression coverage.
templates/resources/organization_custom_properties.md.tmpl Documents default-value limitations.
docs/resources/organization_custom_properties.md Updates generated documentation.

Comment on lines +289 to +291
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("github_organization_custom_properties.test", "default_value", "true"),
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r/organization_custom_properties Type: Bug Something isn't working as documented vNext

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: github_organization_custom_properties of type true_false detects drift on default_value indefinitely

3 participants