title: Jenkins unable to find terraform file in dir
body: <p>I need to launch few instance on AWS using terraform script, i am automating the whole process using jenkins</p>
  <pre><code>pipeline{
      agent any
      tools {
          terraform 'terraform'
      }
       stages{
          stage('Git Checkout'){
              steps{
                  git branch: 'main', credentialsId: 'gitlab id', url: 'https://gitlab.com/ndey1/kafka-infra'
              }
          }
          
          stage('Terraform init'){
              steps{
                  sh 'cd terraform-aws-ec2-with-vpc'
                  sh 'terraform init'
              }
          }
          
          stage('Terraform plan'){
              steps{
                  sh 'terraform plan'
              }
          }
          
          stage('Terraform apply'){
              steps{
                  sh 'terraform apply --auto-approve'
              }
          }
      }
      }
  </code></pre>
  <p>but while running jenins jobs ( pipeline ) it throws the error</p>
  <pre><code>+ cd terraform-aws-ec2-with-vpc
  [Pipeline] sh
  + terraform init
  [0m[1mTerraform initialized in an empty directory![0m
  
  The directory has no Terraform configuration files. You may begin working
  with Terraform immediately by creating Terraform configuration files.[0m
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] stage
  [Pipeline] { (Terraform plan)
  [Pipeline] tool
  [Pipeline] envVarsForTool
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] sh
  + terraform plan
  [31m╷[0m[0m
  [31m│[0m [0m[1m[31mError: [0m[0m[1mNo configuration files[0m
  [31m│[0m [0m
  [31m│[0m [0m[0mPlan requires configuration to be present. Planning without a configuration
  [31m│[0m [0mwould mark everything for destruction, which is normally not what is
  [31m│[0m [0mdesired. If you would like to destroy everything, run plan with the
  [31m│[0m [0m-destroy option. Otherwise, create a Terraform configuration file (.tf
  [31m│[0m [0mfile) and try again.
  [31m╵[0m[0m
  </code></pre>
  <p>though all terraform cod is in the same dir named &quot;kafka-infra&quot; but still its saying no configuration file in dir but terraform init runs successfully , the error comes in the stage of &quot; terraform plan&quot;</p>