Skip to content

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

@jtsaito

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions