Skip to content

[BUG]: Unable to enter anonymous mode as such fail with 401 #2014

@duxbuse

Description

@duxbuse

Expected Behavior

In v5.32.0 I can easily provide no token and it correctly enters anonymous mode and fetches files from a public repository.

I expected the same in later versions.

WORKING

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] No token present; configuring anonymous owner.

Actual Behavior

In V5.42.0 it doesnt enter anonymous mode and then tries to authenticate to the v3/user API and fails with a http 401 response.

BROKEN

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Request Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ REQUEST ]---------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: GET /api/v3/user HTTP/1.1
[DEBUG] provider.terraform-provider-github_v5.42.0: Host: github.***.com
[DEBUG] provider.terraform-provider-github_v5.42.0: User-Agent: go-github/v55.0.0
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept: application/vnd.github.v3+json,application/vnd.github.stone-crop-preview+json
[DEBUG] provider.terraform-provider-github_v5.42.0: X-Github-Api-Version: 2022-11-28
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept-Encoding: gzip
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0: -----------------------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Response Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ RESPONSE ]--------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: HTTP/2.0 401 Unauthorized

Terraform Version

Terraform v1.6.2
on linux_amd64

  • provider registry.terraform.io/hashicorp/google v5.5.0
  • provider registry.terraform.io/hashicorp/google-beta v5.5.0
  • provider registry.terraform.io/hashicorp/null v3.2.1
  • provider registry.terraform.io/hashicorp/random v3.5.1
  • provider registry.terraform.io/hashicorp/time v0.9.1
  • provider registry.terraform.io/integrations/github v5.42.0

Affected Resource(s)

  • github_repository_file

Terraform Configuration Files

# backend+provider.tf

provider "github" {
  base_url = "https://github.***.com/"
}

Steps to Reproduce

terraform plan

Debug Output

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Request Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ REQUEST ]---------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: GET /api/v3/user HTTP/1.1
[DEBUG] provider.terraform-provider-github_v5.42.0: Host: github.***.com
[DEBUG] provider.terraform-provider-github_v5.42.0: User-Agent: go-github/v55.0.0
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept: application/vnd.github.v3+json,application/vnd.github.stone-crop-preview+json
[DEBUG] provider.terraform-provider-github_v5.42.0: X-Github-Api-Version: 2022-11-28
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept-Encoding: gzip
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0: -----------------------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Response Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ RESPONSE ]--------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: HTTP/2.0 401 Unauthorized

Panic Output

│ Error: GET https://github.***.com/api/v3/user: 401 Requires authentication []
│ 
│   with provider["registry.terraform.io/integrations/github"],
│   on backend+provider.tf line 58, in provider "github":
│   58: provider "github" {

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions