Repository navigation
Closed as not planned
Labels
AuthenticationProviderStatus: StaleUsed by stalebot to clean houseType: BugSomething isn't working as documentedd/team
Description
Using the github_team data source with the latest provider version returns 404.
Terraform Version
✗ terraform -v
Terraform v0.13.6
- provider registry.terraform.io/hashicorp/aws v2.48.0
- provider registry.terraform.io/hashicorp/github v4.1.0
- provider registry.terraform.io/hashicorp/null v2.1.2
- provider registry.terraform.io/integrations/github v4.2.0
Affected Resource(s)
- github_team data source
Terraform Configuration Files
data "github_team" "team_details" {
for_each = var.teams
slug = each.key
}
resource "github_team_repository" "repository_team" {
for_each = var.teams
repository = github_repository.repository.name
team_id = data.github_team.team_details[each.key].id
permission = each.value
}and the provider configuration
terraform {
required_providers {
github = {
source = "integrations/github"
version = "4.2.0"
}
}
}
provider "github" {
version = "4.2.0"
organization = "myorg"
token = "blabla"
}Debug Output
Panic Output
Expected Behavior
The data source should return the team information so that it can be used in further resources.
Actual Behavior
The call returns 404. It seems the API call is not built correctly as the organization is not set.
Error: GET https://api.github.com/orgs//teams/b2b: 404 Not Found []
on modules/repository/main.tf line 61, in data "github_team" "team_details":
61: data "github_team" "team_details" {
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- Add the github_team data source.
- Make sure the organization information is set in the provider
- Issue
terraform apply
Important Factoids
References
Reacted by Zoltán Reegn, kscarlett, Kevin Behrens, William Borelli, Hicham Bouissoumer, Robert Keyser, Gastón, Brian A. Teller, Pavel Brodsky, Chris Zeeb and 14 more
Reacted by Jono Spiro, Aleksandar Licul, ICHINOSE Shogo, Hicham Bouissoumer, Toby Pinder and Nick Laferriere
Metadata
Metadata
Assignees
Labels
AuthenticationProviderStatus: StaleUsed by stalebot to clean houseType: BugSomething isn't working as documentedd/team
Type
Projects
- StatusShow more project fields✅ Done
Activity
erumble commentedon Jan 12, 2021
I'm experiencing the same issue. It looks like the org information is not being pulled from the provider's configuration, but from the token. My config looks like:
This should hit the endpoint:
But it is instead hitting:
With
my-userbeing the owner of the token set in theGITHUB_TOKENenv varjspiro commentedon Jan 20, 2021
Yup, same here. It's ignoring everything in the provider block. I was trying to pass creds in via variables.
It always returns
Error: This resource can only be used in the context of an organization, "" is a user.Or I get rate limited because it's not authenticating.
Workaround: Use environment vars for both.
jspiro commentedon Jan 20, 2021
This is much broader than the data source, the provider is not inferring the organization from the provider in any circumstance for me. You may want to rename your bug.
jspiro commentedon Jan 20, 2021
It's a regression since 2.9. I can't say when – I'm only finally able to upgrade now that github_branch_protection_v3 exists.
aliculPix4D commentedon Jan 20, 2021
Same here. After using the workaround by @jspiro and using environment vars for both everything works fine.
wmborelli commentedon Feb 9, 2021
FYI I'm hitting a similar issue using resource "github_team" -
Error: DELETE https://{internal_api_url}/orgs/{org}/teams/{team}/memberships/{owner}: 404 Not Found []
It looks like it creates the team with myself as the maintainer and then attempts to delete me before adding the ldap_dn attribute (I'm assuming). Setting
create_default_maintainer = falsedoesn't solve anything.I'll try to open another issue on this when I have more time.
tibbes commentedon Mar 22, 2021
@eleni-salamani, @jspiro, @aliculPix4D, I believe that this is the same issue as #696 and #697.
As the output of
terraform -vshows,hashicorp/githubandintegrations/githubare both enabled in this Terraform configuration. This means that theprovider "github"block is sent to one of the providers but not the other, which means that the other provider is working in anonymous mode with no token, no owner, and no organization.According to the debug output in the gist @eleni-salamani, it looks like
integrations/githubgets the correct configuration, buthashicorp/githubis the plugin attempting to fetch detail of theb2bteam.If you genuinely need to use both providers, then you need to configure both providers using local names. However, it's also possible that your Terraform configuration is accidentally referring to
hashicorp/google: if you use any module that attempts to use the GitHub provider, but does not declare arequired_providerssection specifyingintegrations/github, then it will implicitly refer tohashicorp/google.All modules that you want to use
integrations/githubmust containeleni-salamani commentedon Mar 22, 2021
@tibbes Many thanks for the reply. For the time being we have switched to using purely the
hashicorp/githubprovider, which works for us.sidcarter commentedon Jun 28, 2021
I was excited to move to
integrations/githubwhen I saw this message:And as soon as I replaced my provider using:
all github stuff broke. Tried a few things, but didn't fix it.
So, just removing the source in required_providers fixed the problem for me. Serves me right to be jumping to the new stuff immediately.
jbdevprimary commentedon Jul 4, 2021
Can confirm the same experience. integrations/github is absolutely shattered by the above.
8 remaining items
robtayl0r commentedon Feb 8, 2022
It seems within a module, if a "github" required_providers block is not defined, the (deprecated?) "hashicorp/github" provider is used.
For example, in order to resolve terraform's 404 errors to the github api, I needed to:
./main.tf./modules/secrets/main.tfIf the github provider is not explicitly defined in the module,
tf applywill result in an errorGET https://api.github.com/repos//some-repo: 404 Not Found [].apujari-hippo commentedon Oct 21, 2022
The above solution will not work as my data is in
data.tfand providers are inmain.tf. If I explicitly add a provider todata.tfI get the following error:apujari-hippo commentedon Oct 21, 2022
Moved all code to
main.tf. Still facing the issue. I encounter this issue when usingapp_authfor authentication(tokenworks fine).ermirizio commentedon Oct 26, 2022
Hi, I'm using terraform cloud as remote backend and I can said none of the above solutions works for me, when using either local backend or s3 bucket it works just fine. Any hints/discoveries on this?
github-actions commentedon Oct 2, 2023
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!h3nryza commentedon Jun 5, 2024
I have a similar issue where I am trying to use the resource github_actions_environment_secret.
The API returns a 404 with a repos// which should only be one /
I have defined Owner/Repo and using a PAT with full access as a test and still get the error.
Went on to define ../owner/repo which corrected the URL but still gives me a 404
Used the API directly to confirm the PAT and payload were correct and because I define the URL is worked 100%.
Seeing similar issues
#1805
pulumi/pulumi-github#248
vveliev-tc commentedon Jul 15, 2024
@nickfloyd any updates on this issue?