forked from palakbhawsar98/Terraform-CI-CD-Pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
39 lines (32 loc) · 881 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
pipeline {
agent any
stages {
stage('TFLint') {
steps {
sh 'tflint --init'
sh 'tflint'
}
}
stage('TFSec') {
steps {
sh 'tfsec'
}
}
stage('Terratest') {
steps {
dir('test') {
sh 'if [ ! -f go.mod ]; then go mod init github.com/palakbhawsar98/Terraform-CI-CD-Pipeline; fi'
sh 'go mod tidy'
sh 'go test'
}
}
}
stage('Terraform workflow') {
steps {
sh 'terraform init'
sh 'terraform plan -out=tfplan'
sh 'terraform apply -auto-approve tfplan'
}
}
}
}