fix: error code on query failure (#59) #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
paths: | |
- ".github/workflows/terraform.yml" | |
- "cmd/**" | |
- "deploy/**" | |
- "pkg/**" | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
AWS_ACCOUNT_ID: ${{ secrets.PROD_AWS_ACCOUNT_NUMBER }} | |
AWS_REGION: us-west-2 | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
role-to-assume: arn:aws:iam::${{ secrets.PROD_AWS_ACCOUNT_NUMBER }}:role/terraform-ci | |
- uses: opentofu/setup-opentofu@v1 | |
- uses: actions/setup-go@v5 | |
- name: Set Staging Environment Variables | |
if: startsWith(github.ref, 'refs/tags/') != true | |
run: | | |
echo "ENV=staging" >> $GITHUB_ENV | |
echo "TF_WORKSPACE=staging" >> $GITHUB_ENV | |
echo "TF_VAR_private_key=${{ secrets.STAGING_PRIVATE_KEY }}" >> $GITHUB_ENV | |
echo "TF_VAR_did=did:web:staging.indexer.storacha.network" >> $GITHUB_ENV | |
- name: Set Production Environment Variables | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo "ENV=production" >> $GITHUB_ENV | |
echo "TF_WORKSPACE=prod" >> $GITHUB_ENV | |
echo "TF_VAR_private_key=${{ secrets.PROD_PRIVATE_KEY }}" >> $GITHUB_ENV | |
echo "TF_VAR_did=did:web:indexer.storacha.network" >> $GITHUB_ENV | |
- name: Tofu Init | |
run: | | |
tofu -chdir="deploy/app" init | |
- name: Ruild Go Apps | |
run: | | |
touch .env | |
make lambdas | |
- name: Terraform Plan | |
if: github.event_name == 'pull_request' | |
run: | | |
tofu -chdir="deploy/app" plan | |
- name: Terraform Apply | |
if: github.event_name != 'pull_request' | |
run: | | |
tofu -chdir="deploy/app" apply -input=false --auto-approve |