-
Notifications
You must be signed in to change notification settings - Fork 59
/
Jenkinsfile
46 lines (37 loc) · 900 Bytes
/
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
pipeline {
agent any
environment {
SVC_ACCOUNT_KEY = credentials('terraform-auth')
}
stages {
stage('Checkout') {
steps {
checkout scm
sh 'mkdir -p creds'
sh 'echo $SVC_ACCOUNT_KEY | base64 -d > ./creds/serviceaccount.json'
}
}
stage('TF Plan') {
steps {
container('terraform') {
sh 'terraform init'
sh 'terraform plan -out myplan'
}
}
}
stage('Approval') {
steps {
script {
def userInput = input(id: 'confirm', message: 'Apply Terraform?', parameters: [ [$class: 'BooleanParameterDefinition', defaultValue: false, description: 'Apply terraform', name: 'confirm'] ])
}
}
}
stage('TF Apply') {
steps {
container('terraform') {
sh 'terraform apply -input=false myplan'
}
}
}
}
}