Expected Behavior
When an organization has custom properties marked as required = true (via github_organization_custom_properties), it should be possible to create a repository with github_repository and provide the required property values during the same terraform apply. This aligns with GitHub's documented organization setting "Require this property for all repositories": https://docs.github.com/en/organizations/managing-organization-settings/managing-custom-properties-for-repositories-in-your-organization#setting-values-for-repositories-in-your-organization.
Actual Behavior
Repository creation fails because required custom properties cannot be provided in the github_repository resource at create time.
Current flow creates a chicken-and-egg problem:
github_repository does not expose an argument/block to set custom property values during create.
github_repository_custom_property requires an existing repository (repository argument).
- If org policy enforces required properties on creation, GitHub API rejects repository creation before
github_repository_custom_property can run.
As a result, there is no valid Terraform path to create a new repository under that policy.
Terraform Version
Terraform v1.11.x
provider registry.terraform.io/integrations/github v6.6.0+
Affected Resource(s)
github_repository
github_repository_custom_property
Terraform Configuration Files
resource "github_organization_custom_properties" "environment" {
property_name = "environment"
value_type = "single_select"
required = true
allowed_values = ["development", "staging", "production"]
}
resource "github_repository" "my_repo" {
name = "my-new-repo"
description = "A new repository"
visibility = "private"
auto_init = true
# No field currently exists to set required custom property values here
}
resource "github_repository_custom_property" "my_repo_env" {
repository = github_repository.my_repo.name
property_name = "environment"
property_type = "single_select"
property_value = ["production"]
}
Steps to Reproduce
- Define an organization custom property with
required = true.
- Attempt to create a new repository using
github_repository.
- Run
terraform apply.
- Observe repository create failing because required custom property value is missing.
Debug Output
Error: POST https://api.github.com/orgs/{org}/repos: 422 Validation Failed
Required custom property 'environment' is missing.
Panic Output
Code of Conduct
Expected Behavior
When an organization has custom properties marked as
required = true(viagithub_organization_custom_properties), it should be possible to create a repository withgithub_repositoryand provide the required property values during the sameterraform apply. This aligns with GitHub's documented organization setting "Require this property for all repositories": https://docs.github.com/en/organizations/managing-organization-settings/managing-custom-properties-for-repositories-in-your-organization#setting-values-for-repositories-in-your-organization.Actual Behavior
Repository creation fails because required custom properties cannot be provided in the
github_repositoryresource at create time.Current flow creates a chicken-and-egg problem:
github_repositorydoes not expose an argument/block to set custom property values during create.github_repository_custom_propertyrequires an existing repository (repositoryargument).github_repository_custom_propertycan run.As a result, there is no valid Terraform path to create a new repository under that policy.
Terraform Version
Affected Resource(s)
github_repositorygithub_repository_custom_propertyTerraform Configuration Files
Steps to Reproduce
required = true.github_repository.terraform apply.Debug Output
Error: POST https://api.github.com/orgs/{org}/repos: 422 Validation Failed Required custom property 'environment' is missing.Panic Output
Code of Conduct