-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (53 loc) · 1.51 KB
/
infrastructure.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Infrastructure
defaults:
run:
shell: bash
working-directory: infrastructure
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
infrastructure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Build & Test lambda
run: |
pip3 install cargo-lambda
rustup update stable && rustup default stable
cargo lambda build --arm64 --release
cd tests
docker-compose up -d
cargo test --verbose
working-directory: infrastructure/lambdas
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ASSUME_ROLE_ARN }}
aws-region: eu-central-1
role-session-name: GitHub-OIDC-TF
- name: Terraform Init
id: init
env:
AWS_BUCKET_NAME: ${{ secrets.AWS_STATE_BUCKET_NAME }}
run: terraform init --backend-config="bucket=${AWS_BUCKET_NAME}"
- name: Terraform Validation
id: validate
run: terraform validate
- name: Terraform Plan
id: plan
if: github.event_name == 'pull_request'
run: terraform plan
- name: Terraform Apply
id: apply
if: github.ref == 'refs/head/main' && github.event_name == 'push'
run: terraform apply -auto-approve