# Data "external" "git\_hash"

**URL:** <https://discuss.hashicorp.com/t/data-external-git-hash/43592>\
**Category:** Terraform\
**Created:** [August 25, 2022, 12:20pm UTC](https://discuss.hashicorp.com/t/data-external-git-hash/43592 "2022-08-25T12:20:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghudevendra](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/raghudevendra/32/30298_2.png) [@raghudevendra](https://discuss.hashicorp.com/u/raghudevendra)\
**Post date:** [August 25, 2022, 12:20pm UTC](https://discuss.hashicorp.com/t/data-external-git-hash/43592/1 "2022-08-25T12:20:51Z")

</div>

Hi,

I have been facing below issue on executing terraform plan command.

Error: failed to execute “files/iac\_git\_info.sh”: fork/exec files/iac\_git\_info.sh: %1 is not a valid Win32 application.

on main.tf line 401, in data “external” “git\_hash”:  
401: data “external” “git\_hash” {

Error: failed to execute “files/iac\_tooling\_version.sh”: fork/exec files/iac\_tooling\_version.sh: %1 is not a valid Win32 application.

on main.tf line 405, in data “external” “iac\_tooling\_version”:  
405: data “external” “iac\_tooling\_version” {

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [August 25, 2022, 3:28pm UTC](https://discuss.hashicorp.com/t/data-external-git-hash/43592/2 "2022-08-25T15:28:31Z")

</div>

Hi @raghudevendra,

From this error message it seems that you are using Terraform on a Windows system.

Windows doesn’t have built-in support for executing shell scripts, so to use this on Windows you will need to change the configuration to run a program that you Windows system knows how to run.

If you have a Unix shell like bash installed on your Windows system separately then you may be able to make this work by specifying that shell at the command to run and then passing the script filename as the argument to the shell.

If you don’t have a Unix shell then you may need to port your script into a form that Windows knows how to run, such as a `.cmd` script for the Windows Command Prompt.

---

<div class="post-metadata">

**Author:** ![raghudevendra](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/raghudevendra/32/30298_2.png) [@raghudevendra](https://discuss.hashicorp.com/u/raghudevendra)\
**Post date:** [August 29, 2022, 9:36am UTC](https://discuss.hashicorp.com/t/data-external-git-hash/43592/3 "2022-08-29T09:36:16Z")

</div>

Hi @apparentlymart

Now i have fixed the Unix shell bash issue on windows by giving bash as below.

data “external” “iac\_tooling\_version” {  
program = [“bash”,“files/tools/iac\_tooling\_version.sh”]  
}

Now i am getting below error on jq. I have installed jq 1.6 but still face error as below.

Error: failed to execute “bash”: jq command not detected in path, please install it..

with data.external.iac\_tooling\_version,  
on main.tf line 259, in data “external” “iac\_tooling\_version”:  
259: data “external” “iac\_tooling\_version” {

And this is my script

#!/usr/bin/env bash

# We need to return an error if things don’t work

set -e

function error\_exit() {  
echo “$1” 1\>&2  
exit 1  
}

function check\_deps() {  
test -f “$(which jq)” || error\_exit “jq command not detected in path, please install it..”  
}

check\_deps

TERRAFORM\_INFO="(terraform version -json)" TERRAFORM\_VERSION=(echo "TERRAFORM\_INFO" | jq .terraform\_version ) TERRAFORM\_REVISION=(echo "TERRAFORM\_INFO" | jq .terraform\_revision ) PROVIDER\_SELECTIONS=(echo "TERRAFORM\_INFO" | jq -c .provider\_selections ) TERRAFORM\_OUTDATED=(echo “$TERRAFORM\_INFO” | jq .terraform\_outdated )

jq -n   
–arg terraform\_version “$TERRAFORM\_VERSION”   
–arg terraform\_revision “$TERRAFORM\_REVISION”   
–arg terraform\_outdated “$TERRAFORM\_OUTDATED”   
–arg provider\_selections “$PROVIDER\_SELECTIONS”   
‘{“terraform\_version”:$terraform\_version, “terraform\_revision”:$terraform\_revision, “terraform\_outdated”:$terraform\_outdated, “provider\_selections”:$provider\_selections}’

# echo “$(echo $TERRAFORM\_INFO |jq -cr)”

# The end!
