-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (97 loc) · 3.38 KB
/
infra-plan.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Infrastructure Plan
on:
pull_request:
paths:
- '_infra/credentials/**/*.tf'
- '_infra/global/**/*.tf'
- 'apps/backend/_infra/prod/storage/**/*.tf'
- 'apps/backend/_infra/prod/compute/**/*.tf'
env:
TF_API_TOKEN: "${{ secrets.TERRAFORM_API_TOKEN }}"
TF_CLOUD_ORGANIZATION: ${{ secrets.TERRAFORM_CLOUD_ORGANIZATION }}
TF_VAR_organization: "\"${{ secrets.TERRAFORM_CLOUD_ORGANIZATION }}\""
jobs:
plan-credentials:
runs-on: ubuntu-latest
outputs:
infraChanged: ${{ steps.infra-changed.outputs.any_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if infra files changed
id: infra-changed
uses: tj-actions/changed-files@v44
with:
files: |
_infra/credentials/**/*.tf
- name: Run terraform plan
if: ${{ steps.infra-changed.outputs.any_changed == 'true' }}
uses: ./.github/actions/terraform-plan
with:
APP_NAME: 'App Credentials'
TF_DIRECTORY: '_infra/credentials'
TF_WORKSPACE: 'snipcode-credentials'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
plan-global:
runs-on: ubuntu-latest
outputs:
infraChanged: ${{ steps.infra-changed.outputs.any_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if infra files changed
id: infra-changed
uses: tj-actions/changed-files@v44
with:
files: |
_infra/global/**/*.tf
- name: Run terraform plan
if: ${{ steps.infra-changed.outputs.any_changed == 'true' }}
uses: ./.github/actions/terraform-plan
with:
APP_NAME: 'App Global'
TF_DIRECTORY: '_infra/global'
TF_WORKSPACE: 'snipcode-global-prod'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
plan-backend-storage:
runs-on: ubuntu-latest
outputs:
infraChanged: ${{ steps.infra-changed.outputs.any_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if infra files changed
id: infra-changed
uses: tj-actions/changed-files@v44
with:
files: |
apps/backend/_infra/prod/storage/**/*.tf
- name: Run terraform plan
if: ${{ steps.infra-changed.outputs.any_changed == 'true' }}
uses: ./.github/actions/terraform-plan
with:
APP_NAME: 'Backend Storage'
TF_DIRECTORY: 'apps/backend/_infra/prod/storage'
TF_WORKSPACE: 'snipcode-backend-storage-prod'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
plan-backend-compute:
runs-on: ubuntu-latest
outputs:
infraChanged: ${{ steps.infra-changed.outputs.any_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if infra files changed
id: infra-changed
uses: tj-actions/changed-files@v44
with:
files: |
apps/backend/_infra/prod/compute/**/*.tf
- name: Run terraform plan
if: ${{ steps.infra-changed.outputs.any_changed == 'true' }}
uses: ./.github/actions/terraform-plan
with:
APP_NAME: 'Backend Compute'
TF_DIRECTORY: 'apps/backend/_infra/prod/compute'
TF_WORKSPACE: 'snipcode-backend-compute-prod'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}