-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (40 loc) · 1.18 KB
/
main.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
name: Deploy to AWS
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
- name: Initialize Terraform
run: terraform init
working-directory: ./src/deployment
- name: Export AWS Credentials
run: |
echo "Exporting AWS credentials..."
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV
- name: Terraform Init
run: terraform init
working-directory: ./src/deployment
- name: Terraform Plan
run: terraform plan
working-directory: ./src/deployment
- name: Terraform Apply
run: terraform apply -auto-approve
working-directory: ./src/deployment
env:
TF_VAR_confirm: "yes" # Automatically confirm the apply