-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
30 lines (30 loc) · 1.42 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
pipeline {
agent any
stages {
stage('Creating Service Principle & Updating Variables') {
steps {
sh './config.sh'
}
}
stage('Initializing Terraform') {
steps {
sh 'docker run --rm -it -v $PWD:/data -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -w /data hashicorp/terraform:latest init -upgrade -var vmw_api_token=${env.API_TOKEN}'
}
}
stage('Evaluate Configuration') {
steps {
sh 'docker run --rm -it -v $PWD:/data -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -w /data hashicorp/terraform:latest plan -var vmw_api_token=${env.API_TOKEN}'
}
}
stage('Deploy an AKS Cluster & Attach to TMC') {
steps {
sh 'docker run --rm -it -v $PWD:/data -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -w /data hashicorp/terraform:latest apply --auto-approve -var vmw_api_token=${env.API_TOKEN}'
}
}
stage('Destroy AKS Cluster & Detach to TMC') {
steps {
sh 'docker run --rm -it -v $PWD:/data -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -w /data hashicorp/terraform:latest destroy --auto-approve -var vmw_api_token=${env.API_TOKEN}'
}
}
}
}