Devops Tools

JenkinsPipeline for Terraform deployment

This blog will help you to use the JenkinsPipeline for Terraform deployment

Tools Used:

  1. Jenkins
  2. Github
  3. 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'
              
             
            }
        }
        
      
      
    }
}
Please follow and like us: