-
Notifications
You must be signed in to change notification settings - Fork 13
61 lines (53 loc) · 1.46 KB
/
cd-api-infra.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
name: Deploy API Infra
on:
push:
branches:
- main
paths:
- "infra/api/**"
jobs:
build-repository:
name: Build Repository
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_wrapper: false
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: analytics
environment: shared
- name: Build Repository
run: |
./bin/terraform-init-and-apply.sh infra/api/build-repository shared
deploy-infra:
name: Deploy Infrastructure
runs-on: ubuntu-latest
strategy:
matrix:
directory: ["database", "service"]
envs: [ "staging", "prod"]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_wrapper: false
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: api
environment: shared
- name: Terraform Init and Apply
run: |
export TF_CLI_ARGS="-input=false -auto-approve"
./bin/terraform-init-and-apply.sh infra/api/${{ matrix.directory }} ${{ matrix.envs }}