terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG] `advanced_security` field not properly handled

Open NiftyMule opened this issue 2 years ago • 2 comments

Problem

We are managing all our company repos via terraform and some of them have github advanced security feature enabled. Last month more people joined the company, and we started using a few more advanced security licenses than we purchased before for github enterprise. Github then disabled us from enabling this feature for new repos, which makes sense and we are negotiating to buy more licenses. However, when making unrelated changes (e.g. add a topic) to those repos that already have advanced security feature enabled, the provider will still generate error 422 Enabling advanced security would exceed seat allowance. []. We tried ignoring security_and_analysis field but it didn't fix the issue.

Terraform Version

v1.1.4

Affected Resource(s)

  • github_repository

Terraform Configuration Files

resource "github_repository" "this" {  # this repo has advanced security enabled already
  # necessary fields
  topics = []

  lifecycle {
    ignore_changes = [
      security_and_analysis
    ]
  }
}

Expected Behavior

After adding a new topic to the repo in terraform config, the provider should update the actual github repo without error as we are not touching advanced security config

Actual Behavior

  • error Error: PATCH https://api.github.com/repos/random-org/random-repo: 422 Enabling advanced security would exceed seat allowance. []
  • actual github repo not updated
  • new topic will be added to the state file, creating drifts between terraform state file and the actual github repo

NiftyMule avatar Jun 05 '23 01:06 NiftyMule

👋 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!

github-actions[bot] avatar Jun 17 '24 01:06 github-actions[bot]

I do think this issue is still active as we ran into this just a few days ago. can someone pin this issue so that it's not closed?

NiftyMule avatar Jun 17 '24 01:06 NiftyMule

This should be resolved by https://github.com/integrations/terraform-provider-github/pull/2397

deiga avatar Jan 01 '26 13:01 deiga