forked from unfor19/terraform-multienv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
58 lines (53 loc) · 1.48 KB
/
.drone.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
kind: pipeline
type: docker
name: terraform-infrastructure
environment:
### -----------------------
### Find and Replace
TF_VAR_app_name: tfmultienv
TF_VAR_region: &AWS_REGION eu-west-1
### -----------------------
AWS_REGION: *AWS_REGION
AWS_DEFAULT_REGION: *AWS_REGION
LIVE_DIR: live
BACKEND_TPL: backend.tf.tpl
steps:
- name: drone-diff
image: xueshanf/awscli:alpine-3.11
commands:
- /bin/bash scripts/drone-diff.sh
- name: prepare-files-folders
depends_on:
- drone-diff
image: xueshanf/awscli:alpine-3.11
commands:
- /bin/bash scripts/prepare-files-folders.sh
- name: prepare-backend
depends_on:
- prepare-files-folders
image: xueshanf/awscli:alpine-3.11
environment:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id_${DRONE_BRANCH//\//-}
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key_${DRONE_BRANCH//\//-}
commands:
- /bin/bash scripts/prepare-backend.sh
- name: terraform-apply
depends_on:
- prepare-files-folders
- prepare-backend
image: unfor19/drone-terraform:1.0.0-tf0.13.1
environment:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id_${DRONE_BRANCH//\//-}
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key_${DRONE_BRANCH//\//-}
settings:
actions:
- validate
- plan
- apply
root_dir: ${DRONE_BRANCH//\//-}/
vars:
environment: ${DRONE_BRANCH//\//-}