integrations / terraform-provider-github

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

[BUG]: data "github_user_external_identity" does not return saml_identity for organisation owner #2429

Open zaMedvedem opened 4 weeks ago

zaMedvedem commented 4 weeks ago

Expected Behavior

output "user_saml_identity" { value = data.github_user_external_identity.myuser.saml_identity } returning saml_identity for the user in the organisation, provided that organisation owner is making this request.

It is accessible for the organisation owner in the GitHub UI, but same information is not accessible in the github terraform provider. GitHub organisation is a part of GitHub Enterprise Account with enabled SAML and SSO.

Actual Behavior

Error: there was no external identity found for username "someuser" in Organization "someorganisation" │ │ with data.github_user_external_identity.myuser, │ on main.tf line 2, in data "github_user_external_identity" "myuser": │ 2: data "github_user_external_identity" "myuser" {

"someuser" and "someorganisation" are sanitized values for actual existing user and organisation used in real config

Terraform Version

Terraform v1.9.7

Affected Resource(s)

Terraform Configuration Files

data "github_user_external_identity" "myuser" {
  username = "someuser"
}

output "user_saml_identity" {
  value = data.github_user_external_identity.myuser.saml_identity
}

output "user_scim_identity" {
  value = data.github_user_external_identity.myuser.scim_identity
}

Steps to Reproduce

$ terraform plan

Debug Output

data.github_user_external_identity.myuser: Reading...

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform planned the following actions, but then encountered a problem:
...
╷
│ Error: there was no external identity found for username "someuser" in Organization "someoranisation"
│ 
│   with data.github_user_external_identity.myuser,
│   on main.tf line 2, in data "github_user_external_identity" "myuser":
│    2: data "github_user_external_identity" "myuser" {
│ 
╵

Panic Output

No response

Code of Conduct

nickfloyd commented 3 weeks ago

Hey @zaMedvedem thanks for tracking this down and sorry for the trouble. Let us know if you'd be interested in fixing the issue and submitting a PR. For now I have labeled this as "Up For Grabs" so that the community can take a stab at getting this fixed as well. ❤️