-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (45 loc) · 1.38 KB
/
infrastruct.yml
File metadata and controls
45 lines (45 loc) · 1.38 KB
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
name: Synchronize shared resources
on:
push:
branches:
- main
pull_request:
branches:
- "*"
jobs:
infrastruct:
name: Infrastructural adaptations
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Setup tofu tooling
uses: opentofu/setup-opentofu@v1
- name: Prepare the cloud directory
working-directory: ./cloud
run: tofu init
- name: Ensure sensible setups
working-directory: ./cloud
run: |
tofu fmt -check
tofu validate
- name: Synchronize existing resources
working-directory: ./cloud
run: ./cloud.sh sync
- name: Plan the upcoming change
if: github.event_name == 'pull_request'
working-directory: ./cloud
run: tofu plan
- name: Actually apply the change
if: github.ref == 'refs/heads/main'
working-directory: ./cloud
run: tofu apply -auto-approve