-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
189 lines (181 loc) · 5.96 KB
/
Taskfile.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
version: '3'
tasks:
### BEGIN SECTION: Terraform shared utility tasks
tf:init:
desc: Common tf initialization task.
preconditions: &necessary-tf-envs
- sh: 'test -n "$TF_VAR_r2_api_token"'
msg: "Missing TF_VAR_r2_api_token in your environment"
- sh: 'test -n "$AWS_REGION"'
msg: "Missing AWS_REGION in your environment"
- sh: 'test -n "$AWS_ACCESS_KEY_ID"'
msg: "Missing AWS_ACCESS_KEY_ID in your environment"
- sh: 'test -n "$AWS_SECRET_ACCESS_KEY"'
msg: "Missing AWS_SECRET_ACCESS_KEY in your environment"
- sh: 'test -n "$AWS_ENDPOINT_URL_S3"'
msg: "Missing AWS_ENDPOINT_URL_S3 in your environment"
requires: &necessary-tf-vars
vars: [TF_PROJECT_DIR]
dir: '{{.TF_PROJECT_DIR}}'
cmds:
- tofu init -backend-config={{.ROOT_DIR}}/infrastructure/backends/cloudflare-r2.conf {{.CLI_ARGS}}
tf:clean:
desc: Common tf project cleaning task.
dir: '{{.TF_PROJECT_DIR}}'
preconditions: *necessary-tf-envs
requires: *necessary-tf-vars
cmds:
- rm -rf ./.terraform .terraform.lock.hcl
tf:run:
desc: Common tf project runner task.
dir: '{{.TF_PROJECT_DIR}}'
preconditions: *necessary-tf-envs
requires: *necessary-tf-vars
cmds:
- tofu {{.CLI_ARGS}}
tf:*:
desc: Common tf project runner task.
dir: '{{.TF_PROJECT_DIR}}'
preconditions: *necessary-tf-envs
requires: *necessary-tf-vars
vars: &subcommand-passthrough-vars
SUBCOMMAND: '{{index .MATCH 0}}'
cmds:
- tofu {{.SUBCOMMAND}} {{.CLI_ARGS}}
### END SECTION: Terraform shared utility tasks
### BEGIN SECTION: Wrangler shared utility tasks
wrangler:login:
desc: Log in to the Wrangler CLI
cmds:
- npx wrangler login
wrangler:*:
desc: Deploy a Wrangler worker project
preconditions: &necessary-wrangler-envs
- sh: 'npx wrangler whoami'
msg: "Wrangler MUST be logged in!"
vars: *subcommand-passthrough-vars
requires: &necessary-wrangler-vars
vars: [WRANGLER_PROJECT_DIR]
dir: '{{.WRANGLER_PROJECT_DIR}}'
cmds:
- npx wrangler {{.SUBCOMMAND}} {{.CLI_ARGS}}
### END SECTION: Wrangler shared utility tasks
### BEGIN SECTION: Terraform modules for eearomatics.com
ee:tf:init:
desc: Initialize the eearomatics.com Terraform module
cmds:
- task: tf:init
vars:
TF_PROJECT_DIR: infrastructure/eearomatics
ee:tf:clean:
desc: Clean the eearomatics.com Terraform module
cmds:
- task: tf:clean
vars:
TF_PROJECT_DIR: infrastructure/eearomatics
ee:tf:*:
desc: Run a command in the eearomatics.com Terraform module
vars: *subcommand-passthrough-vars
cmds:
- task: tf:{{.SUBCOMMAND}}
vars:
TF_PROJECT_DIR: infrastructure/eearomatics
### END SECTION: Terraform modules for eearomatics.com
### BEGIN SECTION: Terraform modules for torinreine.com
tr:tf:init:
desc: Initialize the torinreine.com Terraform module
cmds:
- task: tf:init
vars:
TF_PROJECT_DIR: infrastructure/torinreine
tr:tf:clean:
desc: Clean the torinreine.com Terraform module
cmds:
- task: tf:clean
vars:
TF_PROJECT_DIR: infrastructure/torinreine
tr:tf:*:
desc: Run a command in the torinreine.com Terraform module
vars: *subcommand-passthrough-vars
cmds:
- task: tf:{{.SUBCOMMAND}}
vars:
TF_PROJECT_DIR: infrastructure/torinreine
### END SECTION: Terraform modules for torinreine.com
### BEGIN SECTION: Container-registry workers and Terraform module
registry:wrangler:deploy:
desc: "Deploy the container-registry worker"
cmds:
- task: wrangler:deploy
vars:
WRANGLER_PROJECT_DIR: workers/container-registry
CLI_ARGS: --env production
registry:tf:init:
desc: Initialize the container-registry Terraform module
cmds:
- task: tf:init
vars:
TF_PROJECT_DIR: workers/container-registry/iac
registry:tf:clean:
desc: Clean the container-registry Terraform module
cmds:
- task: tf:clean
vars:
TF_PROJECT_DIR: workers/container-registry/iac
registry:tf:*:
desc: Run a command in the container-registry Terraform module
vars: *subcommand-passthrough-vars
cmds:
- task: tf:{{.SUBCOMMAND}}
vars:
TF_PROJECT_DIR: workers/container-registry/iac
### END SECTION: Container-registry workers and Terraform module
### BEGIN SECTION: Shared cloud resources Terraform module
cloud:tf:init:
desc: Initialize the cloud Terraform module
cmds:
- task: tf:init
vars:
TF_PROJECT_DIR: infrastructure/cloud
cloud:tf:clean:
desc: Clean the cloud Terraform module
cmds:
- task: tf:clean
vars:
TF_PROJECT_DIR: infrastructure/cloud
cloud:tf:*:
desc: Run a command in the cloud Terraform module
vars: *subcommand-passthrough-vars
cmds:
- task: tf:{{.SUBCOMMAND}}
vars:
TF_PROJECT_DIR: infrastructure/cloud
### END SECTION: Shared cloud resources Terraform module
### BEGIN SECTION: Infisical Terraform module
infisical:tf:init:
desc: Initialize the infisical Terraform module
cmds:
- task: tf:init
vars:
TF_PROJECT_DIR: infrastructure/infisical
infisical:tf:clean:
desc: Clean the infisical Terraform module
cmds:
- task: tf:clean
vars:
TF_PROJECT_DIR: infrastructure/infisical
infisical:tf:*:
desc: Run a command in the infisical Terraform module
vars: *subcommand-passthrough-vars
cmds:
- task: tf:{{.SUBCOMMAND}}
vars:
TF_PROJECT_DIR: infrastructure/infisical
### END SECTION: Infisical Terraform module
### BEGIN SECTION: create-cloudflare utilities
cf:create:
desc: Run the create-cloudflare CLI
cmds:
- yarn install --frozen-lockfile
- "{{.ROOT_DIR}}/node_modules/.bin/create-cloudflare {{.CLI_ARGS}}"
### END SECTION: create-cloudflare utilities