fix(resource_github_organization_custom_properties): support bool default values - #3572
fix(resource_github_organization_custom_properties): support bool default values#3572secustor wants to merge 1 commit into
Conversation
|
👋 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. |
|
Please mark clearly which issue this is going to resolve! |
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. |
|
@secustor I meant which issue number/URL. |
deiga
left a comment
There was a problem hiding this comment.
Thanks for the effort so far!
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: config, | ||
| Check: resource.ComposeTestCheckFunc( |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Please update the Description in the resource as well
There was a problem hiding this comment.
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_falsedefaults during state refresh. - Adds regression coverage for empty follow-up plans.
- Documents unsupported
multi_selectdefaults.
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. |
| Check: resource.ComposeTestCheckFunc( | ||
| resource.TestCheckResourceAttr("github_organization_custom_properties.test", "default_value", "true"), | ||
| ), |
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_propertiesofvalue_typetrue_falseanddefault_value.Infinite terraform plan:
Before the change?
customProperty.DefaultValueString()will return"", nillbecause of https://github.com/google/go-github/blob/a3951f514384b06cc428f394672020c14f7efd84/github/orgs_properties.go#L59This forces following workaround
After the change?
With this instead
customProperty.DefaultValueBool()is called and with that the return value istrue, nillwhich will then correctly set in the statePull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!