integrations / terraform-provider-github

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

[BUG]: Silent failure when adding org members #2053

Open jamesgeddes opened 11 months ago

jamesgeddes commented 11 months ago

Expected Behavior

The error report should include some indication of what caused the error.

Actual Behavior

When adding many members to an org, only an exit code 1 was returned. No other information was provided.

Initially, I suspected that using OpenTofu might have been the root cause of the issue, so I switched to Terraform. However, the same problem persisted. The issue was only identified after manually reviewing each of the 60 members, where I found an error concerning the owner members. It turned out that their roles were incorrectly set as "owner" instead of "admin". Ideally, the provider should manage such discrepancies more effectively. It would be even more beneficial if the term "owner" was accepted by the provider, as this is the terminology used in the GUI. Offering a clear explanation of the problem in the usual error notification section, rather than terminating the process with an uninformative error code 1, would greatly enhance the user experience.

Terraform Version

Latest on both Terraform and OpenTofu

Affected Resource(s)

github_membership

Terraform Configuration Files

https://github.com/GeekZoneHQ/estate-config/blob/main/terraform/github.tf

Values are built by https://github.com/GeekZoneHQ/estate-config/blob/main/src/github_usernames_roles_current.py

Steps to Reproduce

https://github.com/GeekZoneHQ/estate-config/actions/runs/7153880037/job/19480798209

Debug Output

...
2023-12-09T22:25:55.0063626Z   # github_membership.all["willwearestudio77"] will be created
2023-12-09T22:25:55.0064476Z   + resource "github_membership" "all" {
2023-12-09T22:25:55.0065073Z       + downgrade_on_destroy = false
2023-12-09T22:25:55.0065661Z       + etag                 = (known after apply)
2023-12-09T22:25:55.0066296Z       + id                   = (known after apply)
2023-12-09T22:25:55.0066894Z       + role                 = "member"
2023-12-09T22:25:55.0067488Z       + username             = "willwearestudio77"
2023-12-09T22:25:55.0068053Z     }
2023-12-09T22:25:55.0068289Z 
2023-12-09T22:25:55.0068562Z   # github_membership.all["xhemals"] will be created
2023-12-09T22:25:55.0069218Z   + resource "github_membership" "all" {
2023-12-09T22:25:55.0069796Z       + downgrade_on_destroy = false
2023-12-09T22:25:55.0070387Z       + etag                 = (known after apply)
2023-12-09T22:25:55.0071012Z       + id                   = (known after apply)
2023-12-09T22:25:55.0071612Z       + role                 = "member"
2023-12-09T22:25:55.0072189Z       + username             = "xhemals"
2023-12-09T22:25:55.0072722Z     }
2023-12-09T22:25:55.0072949Z 
2023-12-09T22:25:55.0073210Z Plan: 60 to add, 0 to change, 0 to destroy.
2023-12-09T22:25:55.0084736Z ##[error]Process completed with exit code 1.


### Panic Output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
github-actions[bot] commented 17 hours ago

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