-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (43 loc) · 1.13 KB
/
.gitlab-ci.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
stages:
- deploy
- destroy
variables:
TF_API_TOKEN: $TF_API_TOKEN
TF_STATE_NAME: default
TF_IMAGE: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/terraform-images/releases/1.4:v1.0.0"
SECURE_FILES_DOWNLOAD_PATH: "./"
deploy:
stage: deploy
image: ${TF_IMAGE}
before_script:
- curl -s https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer | sh
script:
- echo "$JUANKEYS" > juankeys.pem
- chmod 600 juankeys.pem
- gitlab-terraform init
- gitlab-terraform validate
- gitlab-terraform plan
- gitlab-terraform plan-json
- gitlab-terraform apply
- rm juankeys.pem
resource_group: ${TF_STATE_NAME}
cache:
untracked: true
paths:
- /
only:
- main
destroy:
stage: destroy
image: ${TF_IMAGE}
when: manual
before_script:
- curl -s https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer | sh
script:
- echo "$JUANKEYS" > juankeys.pem
- chmod 600 juankeys.pem
- gitlab-terraform destroy
- rm juankeys.pem
resource_group: ${TF_STATE_NAME}
only:
- main