-
-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (72 loc) · 2.46 KB
/
terragrunt.yaml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'Terragrunt'
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
env:
tofu_version: '1.7.1'
tg_version: '0.58.12'
working_dir: 'deployment'
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@main
- name: Check Formatting
uses: gruntwork-io/terragrunt-action@v2
with:
tofu_version: ${{ env.tofu_version }}
tg_version: ${{ env.tg_version }}
tg_dir: ${{ env.working_dir }}
tg_command: 'hclfmt --terragrunt-check --terragrunt-diff'
- name: Check terraform fmt
uses: gruntwork-io/terragrunt-action@v2
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
TF_STATE_POSTGRES_CONN_STR: ${{ secrets.TF_STATE_POSTGRES_CONN_STR }}
with:
tofu_version: ${{ env.tofu_version }}
tg_version: ${{ env.tg_version }}
tg_dir: ${{ env.working_dir }}
tg_command: 'run-all fmt -diff -check'
plan:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: 'Checkout'
uses: actions/checkout@main
- name: Plan All
id: plan
uses: gruntwork-io/terragrunt-action@v2
env: &terragrunt-env
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
TF_STATE_POSTGRES_CONN_STR: ${{ secrets.TF_STATE_POSTGRES_CONN_STR }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.TF_APP_INSTALLATION_ID }}
GITHUB_APP_ID: ${{ secrets.TF_APP_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.TF_APP_PEM_FILE }}
GITHUB_OWNER: ${{ secrets.TF_APP_GITHUB_OWNER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tofu_version: ${{ env.tofu_version }}
tg_version: ${{ env.tg_version }}
tg_dir: ${{ env.working_dir }}
tg_command: 'run-all plan'
tg_comment: 1
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: 'Checkout'
uses: actions/checkout@main
- name: Deploy All
uses: gruntwork-io/terragrunt-action@v2
env: *terragrunt-env
with:
tofu_version: ${{ env.tofu_version }}
tg_version: ${{ env.tg_version }}
tg_dir: ${{ env.working_dir }}
tg_command: 'run-all apply'