This blog will help you to use the JenkinsPipeline for Terraform deployment
Tools Used:
- Jenkins
- Github
- Terraform
JenkinsPipeline for Terraform deployment
pipeline { agent any stages { stage('checkout') { steps { git url: 'git@giturl' } } stage('Set Terraform path') { steps { script { def tfHome = tool name: 'Terraform' env.PATH = "${tfHome}:${env.PATH}" } sh 'terraform --version' } } stage('Provision infrastructure') { steps { sh 'terraform init' sh 'terraform plan -out=plan' sh 'terraform apply plan' } } } }