integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
891 stars 736 forks source link

[BUG]: Importing an internal repo still causes the provider to want to modify visibility from private to internal #2239

Open martinb3 opened 5 months ago

martinb3 commented 5 months ago

Expected Behavior

There should be no change.

Actual Behavior

The provider wants to update visibility from "private" to "internal" after refreshing state.

Terraform Version

Terraform 1.5.6

Affected Resource(s)

github_repository

Terraform Configuration Files

resource "github_repository" "main" {
  name        = ...
  description = ...

  visibility = "internal"

Steps to Reproduce

Simply run an import and then apply. Here's the GitHub UI for the internal repo:

Screenshot 2024-04-23 at 11 38 01 AM

Error Output

My organization doesn't allow changing repo visibility, even though it shouldn't need to be done.

Error: PATCH https://api.github.com/repos/my-org/my-repo: 422 Visibility can't be changed by this user. []

Debug Output

No response

Panic Output

No response

Code of Conduct