-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile.destroy_infra
More file actions
38 lines (35 loc) · 1.25 KB
/
Jenkinsfile.destroy_infra
File metadata and controls
38 lines (35 loc) · 1.25 KB
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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '300'))
ansiColor('xterm') /* This requires AnsiColor plugin */
}
stages {
/* Note this requires "Copy Artifact" plugin installed */
stage('Restore tfstate from "configure infra" job') {
steps {
copyArtifacts(
projectName: 'dev - FortiSASE Automation Telefonica - configure infra',
selector: lastCompleted(),
filter: '**/*',
fingerprintArtifacts: true
)
}
}
stage('Destroy FortiSASE') {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'fortisase-creds',
usernameVariable: 'TF_USER',
passwordVariable: 'TF_PASS')]) {
sh '''
export TF_VAR_username=$TF_USER
export TF_VAR_password=$TF_PASS
terraform destroy -auto-approve
'''
}
}
}
}
}
}