terraform-provider-github
terraform-provider-github copied to clipboard
[BUG]: 422 User doesn't satisfy the two-factor authentication requirements for this organization
Expected Behavior
Gracefully handle when a user doesn't satisfy the two-factor authentication requirements for an organization when being created, rather than produce an error.
Actual Behavior
When I encounter a user that doesn't have two-factor enabled, and I attempt to add them to the GitHub organization, I encounter the below error. As far as I can tell, there doesn't appear to be a data source telling me if a user has two-factor authentication enabled on their account prior to trying to add it to the organization.
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to github_membership.add-to-org["kristian"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an
│ unexpected new value: Root object was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: PUT https://ghes.url/api/v3/organizations/13927/team/28489/memberships/kristian: 422 User doesn't satisfy the two-factor authentication requirements for this organization. [{Resource:TeamMember Field:user Code:no_2fa Message:}]
│
│ with github_team_membership.team-members["Test Group.user.kristian"],
│ on teams.tf line 16, in resource "github_team_membership" "team-members":
│ 16: resource "github_team_membership" "team-members" {
│
Terraform Version
terraform --version
Terraform v1.8.3
on darwin_arm64
+ provider registry.terraform.io/integrations/github v6.2.1
Affected Resource(s)
- github_membership
- github_team_membership
Terraform Configuration Files
No response
Steps to Reproduce
$ terraform apply
Debug Output
No response
Panic Output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct