title: Issue while calling Bash script using External data source in Terraform
body: <p>I have External data source , that is calling the bash script .</p>
  <pre><code>Main.tf : 
  
   resource &quot;aws_ami_from_instance&quot; &quot;QA-ami&quot; {
   name               = &quot;QA-ami&quot;
   source_instance_id = &quot;i-00f4*****75**a&quot;
   }
  
   resource &quot;aws_instance&quot; &quot;QA-server-via-ami&quot; {
   ami = aws_ami_from_instance.QA-ami.id
   instance_type = var.qa_instance_type
   subnet_id = var.qa_subnet_id
   key_name = var.qa_key_name
   }
  
   data &quot;external&quot; &quot;instance_status&quot; { //line  38
  
   program = [&quot;bash&quot;, &quot;${path.module}/check_instance_status.sh&quot;]
  
   query = {
   id = aws_instance.QA-server-via-ami.id
   }
   }
  
    output &quot;test&quot; {
    value = data.external.instance_status.result
    } 
  </code></pre>
  <p>Bash Script  :</p>
  <pre><code>#!/bin/bash
  
  set -e
  
  eval &quot;$(jq -r '@sh &quot;INSTANCE_ID=\(.id)&quot;')&quot;
  
  sleep 600
  
  status=$(aws ec2 describe-instance-status --instance-ids ${INSTANCE_ID} --output json --query 
  'InstanceStatuses[0]')
  
  instance_status=$(echo ${status} | jq -r '.InstanceStatus.Details[0].Status')
  system_status=$(echo ${status} | jq -r '.SystemStatus.Details[0].Status')
  
  jq -n --arg inst_status &quot;$instance_status&quot; \
    --arg sys_status &quot;$system_status&quot; \
    '{&quot;instance_status&quot;:$inst_status,&quot;system_status&quot;:$sys_status}'
  </code></pre>
  <p>But when i am running terraform apply , i am getting below error :</p>
  <p>Error: failed to execute &quot;bash&quot;: bash: ./check_instance_status.sh: No such file or directory</p>
  <p>on main.tf line 38, in data &quot;external&quot; &quot;instance_status&quot;:
  38: data &quot;external&quot; &quot;instance_status&quot; {</p>
  <p>My bash script is present in /check_instance_status.sh , still i am getting error .</p>
  <p>Please assist me .</p>