terralist: Problems to upload module

Hello,

I’m trying to upload a module using the example from the documentation with Github API, but I’m not able to.

When I run

curl -L -X POST "https://terraform.example.com/v1/api/modules/${MODULE}/aws/${VERSION}/upload" \
  -H "Authorization: Bearer x-api-key:$TERRALIST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "download_url": "https://api.github.com/repos/'"${REPO}"'/releases/assets/'"${ASSET_ID}"'",
    "headers": {
      "Accept": "application/octet-stream",
      "Authorization": "Bearer '"${GITHUB_TOKEN}"'",
      "X-GitHub-Api-Version": "2022-11-28"
    }
  }'

I get {"errors":["download failure: bad response code: 404"]}.

It doesn’t seem to be a permission issue, as if I run the below curl using the same GITHUB_TOKEN I can download the zip file.

curl -L -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/octet-stream" -o module.zip "https://api.github.com/repos/${REPO}/releases/assets/${ASSET_ID}"

What am I doing wrong?

PS: I’m using ${{ github.repository }} as $REPO, so it already comes with the owner.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Awesome! Glad to hear.

I’ll update the documentation to avoid future confusion on this subject.

It works like a charm! Thanks very much for your help @valentindeaconu !