Jenkins integration with Terraform

I am trying to run my terraform script through jenkins but I am getting terraform not found error. I checked terraform version in jenkins it is 1.5.7. I am not sure why it is throwing error.

Below is my jenkins pipeline
#!groovy
pipeline {
agent any
environment {

  BUILD_TARGET = "s3_tf"
  DOCKER_REGISTRY = 's3group.azurecr.io'
  GITREPO_URL = 'https://gitlab.s3groupinc.com/devops/terraform.git'

}
options {
skipStagesAfterUnstable()
disableConcurrentBuilds()
}
stages {
stage('Preparation ') {
agent {
any {
reuseNode true
}
}
steps {
sh ‘echo “Preparation and checkout”’
deleteDir() // Clean workspace
checkout ([$class: ‘GitSCM’,
branches: [[name: ‘*/s3_tf’]],
extensions: [],
userRemoteConfigs: [[credentialsId: ‘gitlab-credential’,
url: “${GITREPO_URL}”]]])
}
}
stage(‘init_and_plan’) {
steps {
sh “terraform init”
sh “terraform plan”
}
}
}
}

Are you building on the Jenkins server or using a build agent node?

It is on jenkins server

How did you install Terraform on the Jenkins server? Current version of Terraform is 1.7.4

IIRC you are running Jenkins in a container. So installing Terraform on the Docker Host isn’t going to get it into the container.