integrations / integrations/terraform-provider-github

[BUG]: github_organization_custom_properties: default_value of true_false properties reads back empty, causing a permanent plan diff

Open
#3,618 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Expected Behavior

A `github_organization_custom_properties` resource with `value_type = "true_false"` and `default_value = "false"` (or `"true"`) should plan clean after apply: GitHub stores the default, so Terraform should read it back unchanged.

### Actual Behavior

Every plan shows the default being (re-)added, forever:

```
# github_organization_custom_properties.this["fossa"] will be updated in-place
~ resource "github_organization_custom_properties" "this" {
+ default_value = "false"
id = "fossa"
# (6 unchanged attributes hidden)
}
```

GitHub has the value: `GET /orgs/{org}/properties/schema/fossa` returns `"default_value": "false"` and repositories report `"false"` for the property. The provider's Read uses `customProperty.DefaultValueString()`, which in go-github only returns a value for `string`, `single_select` and `url` types (it is documented as such); for `true_false` (and `multi_select`) it returns `("", false)`, so `default_value` is always written to state as `""`. The code carries a `// TODO: Add support for other types of default values` at that line.

A secondary issue in the same resource: Create/Update always sends `default_value` in the request body, as `""` when unset. GitHub does not accept an empty default for non-required properties, so `required = false` without a default cannot be applied reliably.

### Terraform Version

Terraform v1.14.9, provider integrations/github v6.13.0 (also present on `main`).

### GitHub Installation Type

GitHub.com (organization on the Team plan)

### Affected Resource(s)

- `github_organization_custom_properties`

### Terraform Configuration Files

```hcl
resource "github_organization_custom_properties" "fossa" {
property_name = "fossa"
value_type = "true_false"
required = true
default_value = "false"
description = "Require the fossa status check"
}
```

### Steps to Reproduce

1. `terraform apply` the configuration above (succeeds; the property is created with default `"false"`).
2. `terraform plan` → `+ default_value = "false"` is planned again. Repeat indefinitely.

### Debug Output

n/a — reproducible from the plan output above; root cause is visible in `resourceGithubCustomPropertiesRead` (`DefaultValueString()` for a `true_false` property).

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start in resourceGithubCustomPropertiesRead, where DefaultValueString() is used, and inspect the Create/Update request handling for default_value. Reproduce the apply and plan cycle for a true_false property, then verify that a configured default remains in state and that an unset default does not send an empty value; the related resource tests, if present, should cover both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, go, terraform
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.