-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjenkinsfile
45 lines (42 loc) · 1.17 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
pipeline{
agent any
tools {
terraform 'terraform-1.2.8'
}
environment {
TF_TOKEN_app_terraform_io = credentials('terraform-login')
AWS_ACCESS_KEY_ID = credentials('aws_access_key')
AWS_SECRET_ACCESS_KEY = credentials('aws_secret_key')
REGION = "us-east-1"
}
options {
ansiColor('xterm')
}
stages{
stage('Git Checkout'){
steps{
git 'https://github.com/sureshraodev/terraform-cloud1.git'
}
}
stage('Terraform init'){
steps{
sh "terraform init "
}
}
stage('Terraform plan'){
steps{
sh 'terraform plan -var="aws_access_key=$AWS_ACCESS_KEY_ID" -var="aws_secret_key=$AWS_SECRET_ACCESS_KEY" -var="region=us-east-1"'
}
}
stage('Terraform apply'){
steps{
sh 'terraform apply -auto-approve -var="aws_access_key=$AWS_ACCESS_KEY_ID" -var="aws_secret_key=$AWS_SECRET_ACCESS_KEY" -var="region=us-east-1"'
}
}
}
post {
always {
deleteDir()
}
}
}