Skip to content

[BUG]: creation of github_repository fails from v6.7.0 onwards #2988

Description

@jtsaito

Expected Behavior

Applying the Terraform plan for a new github_repository with vulnerability_alerts = true should create the repository without producing an error.

This is running in an GitHub Enterprise Cloud account.

It works fine with provider version 6.6.0 but fails with 6.7.0 to 6.9.0 (error below).

Possibly related to #2501.

Actual Behavior

Terraform errors, creates the repository but the state is broken with some attributes missing. Just applying Terraform again does not fix the issues.

 Error: DELETE https://api.github.com/repos/lessonnine/jts-test.test/vulnerability-alerts: 422 An enforced security configuration prevented modifying dependabot alerts enablement. Contact your organization owner for details. []
│ 
│   with github_repository.lessonnine-jts-test-test,
│   on generated.tf line 50028, in resource "github_repository" "lessonnine-jts-test-test":
│ 50028: resource "github_repository" "lessonnine-jts-test-test" {

Terraform Version

Terraform version 1.11.4 on linux_amd64.

Affected Resource(s)

  • github_repository

Terraform Configuration Files

resource "github_repository" "lessonnine-jts-test-test" {
  name        = "jts-test.test"
  description = "Just for testing GitHub api (Infrastructure)"

  topics = [
    "infrastructure",
  ]

  has_issues   = false
  has_projects = true
  has_wiki     = false

  allow_rebase_merge = false
  allow_squash_merge = false

  visibility = "private"

  vulnerability_alerts = true # test adding this attribute

  auto_init              = true
  delete_branch_on_merge = true
  allow_update_branch    = true
  allow_auto_merge       = true

  lifecycle {
    prevent_destroy = true

    ignore_changes = [
      # vulnerability alerts are managed via org-wide settings
      vulnerability_alerts,
    ]
  }
}


with provider version:


    github = {
      source  = "integrations/github"
      version = "6.7.0"
    }

Steps to Reproduce

$ terraform apply

Debug Output

Error: DELETE https://api.github.com/repos/lessonnine/jts-test.test/vulnerability-alerts: 422 An enforced security configuration prevented modifying dependabot alerts enablement. Contact your organization owner for details. []
│ 
│   with github_repository.lessonnine-jts-test-test,
│   on generated.tf line 50028, in resource "github_repository" "lessonnine-jts-test-test":
│ 50028: resource "github_repository" "lessonnine-jts-test-test" {

Panic Output

none

Code of Conduct

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

Activity

  1. added
    Type: Bug
    Status: Triage
    on Dec 9, 2025
  2. github-actions commented on Dec 9, 2025

    @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. stevehipwell commented on Dec 9, 2025

    @stevehipwell
    Collaborator

    @jtsaito are you explicitly setting the value on a repo in an organization where this is being managed by the organization? If you don't set it on the repo is it working?

  4. mark-oppenheim commented on Dec 10, 2025

    @mark-oppenheim

    I'm seeing the same issue on 6.8.3, whether I explicity set vulnerability_alerts to true, null or rely on the default.

  5. stevehipwell commented on Dec 11, 2025

    @stevehipwell
    Collaborator

    @mark-oppenheim the current implementation always calls one of the vulnerability alert endpoints. AFAIK this has been the case for a long time.

  6. removed
    Status: Triage
    on Dec 11, 2025
  7. mark-oppenheim commented on Dec 19, 2025

    @mark-oppenheim

    @mark-oppenheim the current implementation always calls one of the vulnerability alert endpoints. AFAIK this has been the case for a long time.

    That makes sense, but what I'm seeing is errors for all values of vulnerability_alerts unless I tie the provider version to < 6.7.

  8. stevehipwell commented on Dec 20, 2025

    @stevehipwell
    Collaborator

    @mark-oppenheim just to confirm that this is a regression since v6.7.0 with the same GitHub settings?

  9. added this to the v6.9.1 Patch milestone on Dec 20, 2025
  10. tobias-jenkner commented on Jan 12, 2026

    @tobias-jenkner

    Repo creation still fails with version 6.9.1 in my case with the following error message:

    Error: DELETE https://github.domain.de/api/v3/repos/ORG/REPO/vulnerability-alerts: 422 Failed to change dependabot alerts status.

  11. stevehipwell commented on Jan 12, 2026

    @stevehipwell
    Collaborator

    @tobias-jenkner could you provide a bit more context?

  12. tobias-jenkner commented on Jan 12, 2026

    @tobias-jenkner

    Terraform Enterprise using Terraform v1.12.2
    GitHub Enterprise 3.17
    Unfortunately, I cannot share my TF code - I would need to create a separate reproduction example - I can do that during the next days, if it is needed.

  13. stevehipwell commented on Jan 12, 2026

    @stevehipwell
    Collaborator

    @tobias-jenkner if you could create a reproduction and open a new issue with it that'd be great and would allow us to focus on your specific issue which may be subtly different to.

    FYI we'd expect a 422 error if you were attempting to do something that couldn't be supported by GitHub (such as explicitly setting the vulnerability alerts value on a repo in an org which is managing this centrally).

  14. 3 remaining items

  15. stevehipwell commented on Jan 12, 2026

    @stevehipwell
    Collaborator

    @tobias-jenkner I'd say that's still a defect as it should be able to work without a value set so worth opening up a new issue.

  16. deiga commented on Jan 12, 2026

    @deiga
    Collaborator

    Apparently GHES has different error messages for validation errors 😬

  17. stevehipwell commented on Jan 12, 2026

    @stevehipwell
    Collaborator

    Apparently GHES has different error messages for validation errors 😬

    That was one of our concerns about checking error strings.

  18. deiga commented on Jan 12, 2026

    @deiga
    Collaborator

    Apparently GHES has different error messages for validation errors 😬

    That was one of our concerns about checking error strings.

    I know that. I really should get the new resource done. Maybe we can get it into 6.10.0 already

  19. jtsaito commented on Jan 23, 2026

    @jtsaito
    ContributorAuthor

    @jtsaito are you explicitly setting the value on a repo in an organization where this is being managed by the organization? If you don't set it on the repo is it working?

    I deeply apologize, the updates escaped my attention.

    Yes, I'm setting the attribute in on create in the repository.

    The error persist in recent provider versions and we remain pinned down to v6.6.0. For v6.6.0 repositories can be created without errors as before.

    My organization's "Global Advanced Security settings" show

    Global Advanced Security settings are enabled for all repositories in this organization where the parent feature is enabled.

    with "GitHub presets"

    Dismiss low-impact alerts for development-scoped dependencies

    @stevehipwell Again, my apologies for my late reply. Please let me know if I should open a separate issue or this one can be re-opened.

  20. stevehipwell commented on Jan 23, 2026

    @stevehipwell
    Collaborator

    Applying the Terraform plan for a new github_repository with vulnerability_alerts = true should create the repository without producing an error.

    @jtsaito this statement is incorrect, if vulnerability alerts are being managed at the org level you can't set the value either way. Could you confirm that you have an issue even when you're not explicitly setting vulnerability_alerts (I suspect that you are).

    @deiga this is similar to the allow_forking issue, we should only hit the endpoint for vulnerability alerts if a value has been explicitly set (and not at all in the next major version).

  21. deiga commented on Jan 23, 2026

    @deiga
    Collaborator

    Applying the Terraform plan for a new github_repository with vulnerability_alerts = true should create the repository without producing an error.

    @jtsaito this statement is incorrect, if vulnerability alerts are being managed at the org level you can't set the value either way. Could you confirm that you have an issue even when you're not explicitly setting vulnerability_alerts (I suspect that you are).

    @deiga this is similar to the allow_forking issue, we should only hit the endpoint for vulnerability alerts if a value has been explicitly set (and not at all in the next major version).

    Yeah, I agree. Although that will be a silent change in behaviour, since the default (depending on context) will change

  22. stevehipwell commented on Jan 23, 2026

    @stevehipwell
    Collaborator

    @deiga technically the behaviour may change, but the current behavior is undefined and it will only be for new repos. I'm working on a PR to fix this behaviour.

  23. jtsaito commented on Jan 23, 2026

    @jtsaito
    ContributorAuthor

    @deiga @stevehipwell Thank you so much for re-opening the issue.

    Currently, our Terraform state for managing repos is blocked so I cannot test. I'll get back to you on Monday at latest.

  24. jtsaito commented on Jan 23, 2026

    @jtsaito
    ContributorAuthor

    Applying the Terraform plan for a new github_repository with vulnerability_alerts = true should create the repository without producing an error.

    @jtsaito this statement is incorrect, if vulnerability alerts are being managed at the org level you can't set the value either way. Could you confirm that you have an issue even when you're not explicitly setting vulnerability_alerts (I suspect that you are).

    @stevehipwell Yes, I can confirm that I have an issue even when I'm not explicitely setting vulnerability_alerts.

    I ran the Terraform apply without setting the vulnerability_alerts as follows.

    Image Image Image

    This still resulted in the following error.

    Image
  25. jtsaito commented on Feb 9, 2026

    @jtsaito
    ContributorAuthor

    @stevehipwell Thank you so much! I can confirm this has solved our issue.

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

    Type: Bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions