-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsfile
54 lines (49 loc) · 1.27 KB
/
jenkinsfile
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
pipeline {
agent any
parameters {
choice(
choices: ['plan', 'apply', 'destroy'],
description: 'Run plan / apply / destroy',
name: 'ACTION'
)
}
stages {
stage('Infra Init') {
steps {
dir('./terraform-aws/ecs-module') {
sh 'terraform init'
}
}
}
stage('Infra Plan') {
when {
environment name: 'ACTION', value: 'plan';
}
steps {
dir('./terraform-aws/ecs-module') {
sh 'terraform plan'
}
}
}
stage('Infra Apply') {
when {
environment name: 'ACTION', value: 'apply';
}
steps {
dir('./terraform-aws/ecs-module') {
sh 'terraform apply -auto-approve'
}
}
}
stage('Infra Destroy') {
when {
environment name: 'ACTION', value: 'destroy';
}
steps {
dir('./terraform-aws/ecs-module') {
sh 'terraform destroy -auto-approve'
}
}
}
}
}