-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
108 lines (95 loc) · 3.07 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
version: 3
dotenv:
- ./configuration/defaults.conf
vars:
FUNCTION_ARTIFACT: terraform/ask-ai-function-bundle.zip
tasks:
install:
desc: Install dependencies (node modules)
cmds:
- pnpm install
update-dependencies:
desc: Update dependencies (node modules)
cmds:
- pnpm update && pnpm upgrade
clean:
desc: Clean artifacts and dependencies
cmds:
- rm -rf dist/
- rm -rf {{.FUNCTION_ARTIFACT}}
- rm -rf out/
compile:
desc: Compile typescript files
cmds:
- tsc
package:
desc: Package and zip the application code for deployment
cmds:
- task: clean
- task: install
- task: compile
- mkdir -p dist
- cp -R node_modules out/* package*.json dist
terraform-fmt:
dir: terraform
desc: Format terraform files
cmds:
- |
terraform fmt
terraform-providers-lock:
dir: terraform
desc: Lock terraform providers for all platforms
cmds:
- |
terraform providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=linux_amd64
terraform-init:
dir: terraform
desc: Initialize terraform backend, providers, plugins and modules
# deps:
# - terraform-providers-lock
cmds:
- |
terraform init -upgrade \
-backend-config="bucket=${BACKEND_BUCKET_NAME}" \
-backend-config="prefix=${BACKEND_BUCKET_TERRAFORM_PREFIX}"
terraform-plan:
dir: terraform
desc: Creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.
cmds:
- task: terraform-init
- task: package
- |
terraform plan \
-var "project_id=${GOOGLE_CLOUD_PROJECT_ID}" \
-var "region=${GOOGLE_CLOUD_PROJECT_REGION}" \
-var "zone=${GOOGLE_CLOUD_PROJECT_ZONE}" \
-var "project_number=${GOOGLE_PROJECT_NUMBER}" \
-var "backend_bucket_name=${BACKEND_BUCKET_NAME}" \
-var "static_ai_website_bucket_name=${STATIC_AI_WEBSITE_BUCKET_NAME}"
terraform-apply:
dir: terraform
desc: Apply the planned changes to the target infrastructure
deps:
- terraform-plan
cmds:
- defer: { task: clean }
- |
terraform apply -auto-approve \
-var "project_id=${GOOGLE_CLOUD_PROJECT_ID}" \
-var "region=${GOOGLE_CLOUD_PROJECT_REGION}" \
-var "zone=${GOOGLE_CLOUD_PROJECT_ZONE}" \
-var "project_number=${GOOGLE_PROJECT_NUMBER}" \
-var "backend_bucket_name=${BACKEND_BUCKET_NAME}" \
-var "static_ai_website_bucket_name=${STATIC_AI_WEBSITE_BUCKET_NAME}"
terraform-destroy:
dir: terraform
desc: Delete all resources created by terraform
cmds:
- |
terraform destroy -auto-approve \
-var "project_id=${GOOGLE_CLOUD_PROJECT_ID}" \
-var "region=${GOOGLE_CLOUD_PROJECT_REGION}" \
-var "zone=${GOOGLE_CLOUD_PROJECT_ZONE}" \
-var "project_number=${GOOGLE_PROJECT_NUMBER}" \
-var "backend_bucket_name=${BACKEND_BUCKET_NAME}" \
-var "static_ai_website_bucket_name=${STATIC_AI_WEBSITE_BUCKET_NAME}"