Skip to content

Commit

Permalink
jenkins-deploy vnet
Browse files Browse the repository at this point in the history
  • Loading branch information
cfj123 committed Aug 30, 2023
1 parent 25d77e5 commit 56d36b1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,34 @@ pipeline {
tenantIdVariable: 'ARM_TENANT_ID'
), string(credentialsId: 'access_key', variable: 'ARM_ACCESS_KEY')]) {
sh """
echo "Preview Deploy Plan"
echo "Preview Destroy Plan"
terraform plan -destroy -var "client_id=$ARM_CLIENT_ID" -var "client_secret=$ARM_CLIENT_SECRET" -var "subscription_id=$ARM_SUBSCRIPTION_ID" -var "tenant_id=$ARM_TENANT_ID"
"""
}
}

}
}
stage('Terraform Destroy') {
when {
expression { params.action == 'Terraform Destroy' }
}
steps {
ansiColor('xterm') {
withCredentials([azureServicePrincipal(
credentialsId: 'Jenkins',
subscriptionIdVariable: 'ARM_SUBSCRIPTION_ID',
clientIdVariable: 'ARM_CLIENT_ID',
clientSecretVariable: 'ARM_CLIENT_SECRET',
tenantIdVariable: 'ARM_TENANT_ID'
), string(credentialsId: 'access_key', variable: 'ARM_ACCESS_KEY')]) {
sh """
echo "Terraform Destroy"
terraform destroy -var "client_id=$ARM_CLIENT_ID" -var "client_secret=$ARM_CLIENT_SECRET" -var "subscription_id=$ARM_SUBSCRIPTION_ID" -var "tenant_id=$ARM_TENANT_ID"
"""
}
}
}
}
}
}

0 comments on commit 56d36b1

Please sign in to comment.