feat: serverless task processing API with Terraform IaC #1
This file contains hidden or 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: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "terraform/**" | |
| - "src/**" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Package Lambda | |
| run: | | |
| mkdir -p terraform/.build | |
| cd src && zip -r ../terraform/.build/lambda.zip . -x "__pycache__/*" "*.pyc" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - uses: hashicorp/setup-terraform@v3 | |
| - name: Terraform Init | |
| run: cd terraform && terraform init | |
| - name: Terraform Plan | |
| run: cd terraform && terraform plan -no-color | |
| continue-on-error: false | |
| - name: Terraform Apply | |
| run: cd terraform && terraform apply -auto-approve -no-color |