Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: github_ip_ranges unable to parse meta endpoint. #2357

Open
1 task done
nairb774 opened this issue Aug 21, 2024 · 9 comments
Open
1 task done

[BUG]: github_ip_ranges unable to parse meta endpoint. #2357

nairb774 opened this issue Aug 21, 2024 · 9 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@nairb774
Copy link
Contributor

Expected Behavior

The following will provide a list of IP addresses:

data "github_ip_ranges" "default" {}

Actual Behavior

It fails with the following:

Error: json: cannot unmarshal object into Go struct field APIMeta.domains of type []string
with data.github_ip_ranges.default
on github.tf line 1, in data "github_ip_ranges" "default":

data "github_ip_ranges" "default" {}

Terraform Version

Terraform v1.9.4 + github provider 6.2.3

Affected Resource(s)

  • github_ip_ranges

Terraform Configuration Files

data "github_ip_ranges" "default" {}

Steps to Reproduce

$ terraform plan

Debug Output

No response

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nairb774 nairb774 added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Aug 21, 2024
@legoscia
Copy link

Seems like it works when downgrading the provider to 6.2.2. It only fails with 6.2.3.

@fideloper
Copy link

🫡 Same error here, gonna use:

provider "github" {
  version = "6.2.2" 
}

for now (using Terraform v1.9.4 with it)

@polamjag
Copy link

polamjag commented Aug 22, 2024

A little investigations:

The resource github_ip_ranges depends on api.github.com/meta via APIMeta struct type of google/go-github.

The error described above, "cannot unmarshal object into Go struct field APIMeta.domains of type []string with data.github_ip_ranges.default", says that field APIMeta.domains is the cause of error. APIMeta.domains is defined as map[string][]string json:"domains,omitempty" in go-github:

However, observing the actual response from api.github.com/meta, there are artifact_attestations property under domains, with schema that deviates from the []string form -- there are trust_domain field with string and services field with array of strings.

Note that the API document of GitHub about this endpoint does not mention about the artifact_attestations field.

Personally, I feel this is most likely an upstream google/go-github issue. On the other hand, this is likely to involve incompatible changes to the API, which seems like a difficult problem.

@polamjag
Copy link

I found that the Domains field in APIMeta introduced in google/go-github#3121, which included in v62.0.0 release of google/go-github.

As far as I can see, google/go-github's version is upgraded in #2304, which included in v6.2.3 release of terraform-provider-github.

However, if this is happening with an older version, as is also the case at #2357 (comment) then I don't know what could be causing this.

@polamjag
Copy link

Now that the upstream issue has been resolved in google/go-github#3249 (cc google/go-github#3248), all we have to do is wait for the next release 👀

@gabrielstuff
Copy link

gabrielstuff commented Aug 28, 2024

Got the same issue, on a mac.

macOS Sonoma 14.5

➜ terraform --version
Terraform v1.9.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.61.0
+ provider registry.terraform.io/hashicorp/helm v2.14.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.31.0
+ provider registry.terraform.io/hashicorp/random v3.6.2
+ provider registry.terraform.io/integrations/github v6.2.2
+ provider registry.terraform.io/oboukili/argocd v6.1.1

Your version of Terraform is out of date! The latest version
is 1.9.5. You can update by downloading from https://www.terraform.io/downloads.html

Going back to 6.2.2 did the trick.

EDIT

Updated terraform to the latest and it still fail with 6.2.3

@devopsrick
Copy link

still fails with 6.3.0

@priyashpatil
Copy link

still fails with 6.3.0

Same for me

@polamjag
Copy link

The upstream problem is resolved and released in google/go-github#3266 as go-github v65.0.0, so #2359 should fix this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

8 participants