Skip to content

[BUG]: github_repository creation fails when organization enforces required custom properties (no way to set them at create time) #3304

Open

Description

@rodwill

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:

  1. github_repository does not expose an argument/block to set custom property values during create.
  2. github_repository_custom_property requires an existing repository (repository argument).
  3. 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

  1. Define an organization custom property with required = true.
  2. Attempt to create a new repository using github_repository.
  3. Run terraform apply.
  4. 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

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    Type: Bug
    Status: Triage
    on Mar 24, 2026
  2. github-actions commented on Mar 24, 2026

    @github-actions

    👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

  3. added
    Type: Feature
    and removed
    Type: Bug
    on Mar 24, 2026
  4. mbansal86 commented on Aug 19, 2026

    @mbansal86

    Hello Team, kindly request that you prioritize this issue, as it is impacting me as well and appears to be affecting many users. Your prompt attention and support in resolving this issue would be greatly appreciated.

  5. deiga commented on Aug 19, 2026

    @deiga
    Collaborator

    @mbansal86 We will take a look at this when there is capacity for it. We're volunteers doing this as a hobby.

    If you want to influence priorities you should contact your GitHub sales representative and ask them if this issue can be prioritised

  6. alexhumphreys commented on Sep 17, 2026

    @alexhumphreys

    I'd like to pick this up. I'd propose a repeated custom_property block on github_repository (same fields as github_repository_custom_property) that's sent in the create request, with the provider only managing the property names declared in config. That should handle multi_select and avoids perpetual diffs from org default values, I think the map approach in #3322 might run into issues there. Happy to adjust if you'd prefer a different shape.

    cc @faradayfan, since this overlaps with #3322. Not trying to step on that work, happy to coordinate.

  7. deiga commented on Sep 17, 2026

    @deiga
    Collaborator

    @alexhumphreys lovely to see you're eager 🤩

    We want to reduce the amount of configuration inside the github_repository resource, so you're suggested direction isn't ideal.
    I also think that repo custom properties are a separate API endpoint from repo CRUD, putting that in conflict with ARCHITECTURE.md

  8. dtkachenko-bai commented on Oct 20, 2026

    @dtkachenko-bai

    This affects us. And I'm in favor of proposed solution.

  9. rankin-tr commented on Nov 13, 2026

    @rankin-tr

    This is a pain for my organization. The web UI is able to handle this gracefully. Id love to see feature parity with Terraform.

    I've pinged my rep a few times. How can we gain some traction here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageType: Featurer/repository

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions