forked from CiscoDevNet/terraform-sdwan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.vmware
64 lines (64 loc) · 1.53 KB
/
Jenkinsfile.vmware
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
59
60
61
62
63
64
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: terraform
image: jasonking/terraform-sdwan
command:
- sleep
args:
- 99d
tty: true
"""
}
}
options {
disableConcurrentBuilds()
lock resource: 'jenkins_terraform_sdwan'
}
environment {
TF_VAR_vsphere_user = credentials('cpn-rtp-vc1-username')
TF_VAR_vsphere_password = credentials('cpn-rtp-vc1-password')
TF_VAR_vsphere_server = credentials('cpn-rtp-vc1-server')
}
stages {
stage('Terraform init') {
steps {
container('terraform') {
sh 'cd vmware && terraform init'
}
}
}
stage('Terraform plan') {
steps {
configFileProvider([configFile(fileId: 'terraform-rtp.tfvars', targetLocation: 'vmware/terraform.tfvars')]) {
container('terraform') {
sh 'cd vmware && terraform plan'
}
}
}
}
stage('Terraform apply') {
steps {
configFileProvider([configFile(fileId: 'terraform-rtp.tfvars', targetLocation: 'vmware/terraform.tfvars')]) {
container('terraform') {
sh 'cd vmware && terraform apply -auto-approve'
}
}
}
}
stage('Terraform destroy') {
steps {
configFileProvider([configFile(fileId: 'terraform-rtp.tfvars', targetLocation: 'vmware/terraform.tfvars')]) {
container('terraform') {
sh 'cd vmware && terraform destroy -auto-approve'
}
}
}
}
}
}