Skip to content

[FEAT]: Support github_release_asset data source #2513

Closed

Description

@mdb

Describe the need

A github_release_asset data source would enable users to natively fetch and/or read GitHub release assets in Terraform.

For example, imagine a owner/repo GitHub release with various *.json file assets. To read those *.json files' contents via a github_release_asset data source, I'm imagining something akin to the following (although, it would be useful to support additional/alternative arguments beyond just id too, and perhaps even the option to download the asset):

data "github_release" "latest" {
  repository  = "owner"
  owner       = "repo"
  retrieve_by = "latest"
}

data "github_release_asset" "release_assets" {
  count = length(data.github_release.latest.assets)
  url   = data.github_release.latest.assets[count.index].url
}

output "release_assets" {
  value = data.github_release_asset.release_assets.*.body
}

However, currently, without a github_release_asset data source, it's necessary to utilize suboptimal workarounds, such as the use of the http provider and some not-ideal mechanism (such as a var.github_token) for providing a GitHub token:

data "github_release" "latest" {
  repository  = "owner"
  owner       = "repo"
  retrieve_by = "latest"
}

data "http" "release_assets" {
  count = length(data.github_release.latest.assets)
  url   = data.github_release.latest.assets[count.index].url

  request_headers = {
    Accept        = "application/octet-stream"
    Authorization = "Bearer ${var.github_token}"
  }
}

output "release_assets" {
  value = data.http.release_assets.*.body
}

Note that, in addition to requiring the use of an additional provider (i.e. the http provider), the use of the var.github_token creates a few complications:

  1. It's necessary to ensure it's not printed in plain text in logs, Terraform state, etc.
  2. If its value is generated dynamically via a GitHub app -- and if plan and apply are divided across distinct phases run on different CI/CD compute infrastructure, each with their own distinct var.github_token-generation -- then the token's value can change across each phase, resulting in Error: Can't change variable when applying a saved plan during apply.

So, a github_release_asset data source would be very helpful!

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

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

Activity

  1. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Dec 23, 2024
  2. mdb commented on May 5, 2025

    @mdb
    ContributorAuthor

    @nickfloyd I opened a PR (#2514) for this back in December. Is there anything I can do to help steward along that PR? Are you the best person to ping for reviews? Thanks!

  3. added a commit that references this issue on Jan 29, 2026
  4. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Jan 29, 2026
  5. felipebraga commented on Feb 12, 2026

    @felipebraga

    @stevehipwell the PR #2514 didn't work, it returns 406 when trying to download. I opened the #3186.

  6. stevehipwell commented on Feb 12, 2026

    @stevehipwell
    Collaborator

    @felipebraga thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: FeatureNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions