-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathterraform-k8s.txt
More file actions
37 lines (36 loc) · 836 Bytes
/
Copy pathterraform-k8s.txt
File metadata and controls
37 lines (36 loc) · 836 Bytes
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
// Terraform Pipeline
pipeline {
agent any
parameters {
choice choices: ['apply', 'destroy'], description: 'Terraform flow', name: 'WORKFLOW'
}
stages {
stage ('Git Checkout') {
steps {
git branch: 'main', url: 'https://github.com/soravkumarsharma/GitOps-TicTacToe-Config.git'
}
}
stage ('Create SSH Key and Modify the Permission') {
steps {
dir('k8s_cluster/ssh_key') {
sh 'ssh-keygen -t rsa -b 2048 -f k8s -N "" -q'
sh "chmod 400 k8s"
}
}
}
stage ('Terraform Init') {
steps {
dir('k8s_cluster') {
sh "terraform init"
}
}
}
stage ('Terraform apply or destroy') {
steps {
dir('k8s_cluster'){
sh "terraform ${WORKFLOW} --auto-approve"
}
}
}
}
}