-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
51 lines (50 loc) · 1.45 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent any
stages {
stage('Create VPN') {
environment {
TF_VAR_public_ip = <REPLACE ME>
AWS_DEFAULT_REGION = 'us-east-1'
}
agent {
docker { image 'paulmarsicloud/terragrunt-awscli:latest' }
}
input {
message "Proceed?"
ok "Yes"
}
steps {
sh 'terragrunt init --terragrunt-non-interactive; terragrunt apply -auto-approve'
script {
env.BUCKET = sh(script: 'terragrunt output -raw bucket', returnStdout: true)
}
}
}
stage('Obtain openvpn.ovpn file') {
steps {
sh('aws s3 cp s3://$BUCKET/openvpn.ovpn .')
}
post {
always {
archiveArtifacts artifacts: 'openvpn.ovpn', fingerprint: true
}
}
}
stage('Destroy VPN') {
environment {
TF_VAR_public_ip = <REPLACE ME>
AWS_DEFAULT_REGION = 'us-east-1'
}
agent {
docker { image 'paulmarsicloud/terragrunt-awscli:latest' }
}
input {
message "Proceed?"
ok "Yes"
}
steps {
sh 'terragrunt init --terragrunt-non-interactive; terragrunt destroy -auto-approve'
}
}
}
}