Skip to content

[BUG]: No warning/error on conflicting resource properties for github_repository #2264

Description

@garysassano

Expected Behavior

The Terraform provider currently exhibits a problematic behavior where it silently ignores certain configuration settings when conflicting configurations are present.

Specifically, if a user defines squash_merge_commit_message or squash_merge_commit_title while disabling squash merges through allow_squash_merge = false, these settings are rendered meaningless. Similarly, specifying merge_commit_message or merge_commit_title without enabling allow_merge_commit has no effect.

Although this behavior is documented, relying solely on documentation is insufficient. Users may easily overlook these details, leading to unexpected outcomes and configuration confusion.

To enhance user experience and prevent silent misconfigurations, the provider should implement stronger validation mechanisms. Instead of silently ignoring conflicting settings, it should either:

  • Issue a warning during plan or apply stages, explicitly informing users about the conflict and the settings being ignored.
  • Throw an error, preventing the deployment of a configuration containing these contradictions, ensuring users address the issue before proceeding.

This proactive approach would provide clearer feedback, reduce user frustration, and promote a more robust and reliable configuration process.

Actual Behavior

see above

Terraform Version

v1.8.3

Affected Resource(s)

  • github_repository

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

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

Activity

  1. added
    Status: Triage
    Type: Bug
    on May 16, 2024
  2. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon May 20, 2024
  3. added
    Status: Up for grabs
    and removed
    Status: Triage
    on Jun 17, 2024
  4. github-actions commented on Mar 15, 2025

    @github-actions

    👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

  5. added
    Status: Stale
    on Mar 15, 2025
  6. garysassano commented on Mar 15, 2025

    @garysassano
    ContributorAuthor

    Keep.

  7. removed
    Status: Stale
    on Mar 16, 2025
  8. tekumara commented on May 3, 2025

    @tekumara

    I've hit this too, the symptoms I've seen are a plan to update merge_commit_message and merge_commit_title even when allow_merge_commit=false, eg:

      # module.setup-mac.github_repository.repo will be updated in-place
    ! resource "github_repository" "repo" {
            id                          = "setup-mac"
    !       merge_commit_message        = "PR_TITLE" -> "PR_BODY"
    !       merge_commit_title          = "MERGE_MESSAGE" -> "PR_TITLE"
            name                        = "setup-mac"
            # (35 unchanged attributes hidden)
    
            # (1 unchanged block hidden)
        }

    Which then applies successfully but does nothing, so on the next plan it wants to redo the above.

    If however I try to make the same change via the api directly I get:

    ❯ gh api --method PATCH repos/tekumara/setup-mac \
      -H "Accept: application/vnd.github+json" \
      -H "X-GitHub-Api-Version: 2022-11-28" \
      -f merge_commit_message="PR_BODY" \
      -f merge_commit_title="PR_TITLE"
    {
      "message": "Validation Failed",
      "errors": [
        {
          "message": "Sorry, you need to allow the merge commit strategy in order to set the default merge commit message title and message. (no_merge_strategy)",
          "resource": "Repository",
          "field": "merge_commit_allowed",
          "code": "invalid"
        }
      ],
      "documentation_url": "https://docs.github.com/rest/repos/repos#update-a-repository",
      "status": "422"
    }
    

    A validation error during the plan would be ideal, if that's possible

  9. github-actions commented on Jan 28, 2026

    @github-actions

    👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

  10. added
    Status: Stale
    on Jan 28, 2026
  11. garysassano commented on Jan 28, 2026

    @garysassano
    ContributorAuthor

    Keep.

  12. removed
    Status: Stale
    on Jan 29, 2026
  13. deiga commented on Jan 29, 2026

    @deiga
    Collaborator

    @garysassano Would you be willing to submit a PR for this change?

  14. moved this from Backlog to In Progress in Terraform Provideron Mar 29, 2026
  15. removed
    Status: Up for grabs
    on Jul 14, 2026
  16. self-assigned this
    on Jul 14, 2026
  17. added this to the v6.14.0 milestone on Jul 14, 2026
  18. added theissue type on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Bugr/repository

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions