Skip to content

Commit

Permalink
Update TF cloud variable set on release (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Sep 25, 2022
1 parent 7f7e2f8 commit e1ccabc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ jobs:
push: true
tags: "ghcr.io/${{ github.repository_owner }}/service-hub:${{ steps.version.outputs.version }}"

- name: Update Terraform variable set
run: |
variable_id=$(curl -sSL \
--header "Authorization: Bearer ${{ secrets.TERRAFORM_CLOUD_TOKEN }}" \
--header "Content-Type: application/vnd.api+json" \
--request GET \
https://app.terraform.io/api/v2/varsets/${{ secrets.TERRAFORM_CLOUD_VARSET_ID }} \
| jq -r '.data.relationships.vars.data[0] | .id')
curl -sSL \
--header "Authorization: Bearer ${{ secrets.TERRAFORM_CLOUD_TOKEN }}" \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data '{"data": {"type": "vars", "attributes": {"value": "${{ steps.version.outputs.version }}"}}}' \
"https://app.terraform.io/api/v2/varsets/${{ secrets.TERRAFORM_CLOUD_VARSET_ID }}/relationships/vars/$variable_id"

0 comments on commit e1ccabc

Please sign in to comment.