Closed smiller171 closed 6 months ago
@anGie44 here's the new issue
thank you @smiller171 !
hmm it's interesting because, locally I tried to do something similar with:
provider "github" {}
data "github_release" "this" {
repository = "terraform-provider-aws"
owner = "terraform-providers"
retrieve_by = "tag"
release_tag = "v2.61.0"
}
output "github_release_assets_url" {
value = data.github_release.this.asserts_url
}
and this returns as expected with:
github_release_assets_url = https://api.github.com/repos/terraform-providers/terraform-provider-aws/releases/26296110/assets
but if I do
provider "github" {}
data "github_release" "this" {
repository = "terraform-provider-github"
owner = "terraform-providers"
retrieve_by = "tag"
release_tag = "v2.7.0" // or any other tag
}
output "github_release_assets_url" {
value = data.github_release.this.asserts_url
}
I get a similar message as in your comment:
data.github_release.this: Refreshing state...
Error: GET https://api.github.com/repos/terraform-providers/terraform-provider-github/releases/tags/v2.7.0: 404 Not Found []
on main.tf line 3, in data "github_release" "this":
3: data "github_release" "this" {
I wonder if there's an issue with the actual ownernship of a github_repository or something about the releases being accessible for certain repositories (perhaps a setting of sort)?
b/c via the browser, a call to https://api.github.com/repos/terraform-providers/terraform-provider-github/releases?
results in this empty array[]
while a call to the aws provider for example returns a full array of results
Maybe it has to do with how the release is created?
ugh...in the terraform-provider-aws
repo it must be tags
and in the terraform-provider-github
repo it must be tag
Sounds like the only right way to do it is to try both? The difference seems totally undocumented.
actually this post here may explain what we're seeing: https://stackoverflow.com/questions/26140372/cannot-get-releases-for-a-repo-with-the-github-api
yep, even in this repository you can see: releases technically show up in the UI but they aren't necessarily "published" as described in the link..so I don't think this is necessarily linked to the retrieve_by method of tag
or tags
in the data_source, but rather how tags/releases are created within the repo of interest..honestly it seems a bit confusing in the github UI b/c it's hard to differentiate btwn published/unpublished releases since they're technically listed and visible
@anGie44 I thought that was it too, but I tried to properly publish a release and /tags/
still doesn't work for me
@smiller171 ugh quite strange indeed.maybe reaching out to Github Support might give better insight to this interesting tags vs. tag discrepancy?
Experimentation results follow:
This seems like access to releases requires some level of permissions that may not be consistent across all organizations for my account.
👋 Hey Friends, this issue has been automatically marked as stale
because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned
label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
👋 Hey Friends, this issue has been automatically marked as stale
because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned
label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
While Trying to use the releases functionality I discovered that the release tag url is being built incorrectly, making it impossible to get a release by tag. This is actually an issue with an upstream dependency and I've opened a PR with them to resolve it. https://github.com/google/go-github/pull/1520
Terraform Version
Terraform v0.12.24
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
https://gist.github.com/smiller171/3d098ae89f1e89add580c25cd37fd389
Panic Output
N/A
Expected Behavior
Get URL of release assets
Actual Behavior
404 error because it's building the release url incorrectly
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform plan
Important Factoids
N/A
References
https://github.com/google/go-github/pull/1520