I am on Windows 10 machine, and
I have a simple terraform configuration to understand external provider. And the external provider in this case is bash. When I have jq to format the output, I get the following error.
data.external.simple-jq-test: Reading...
╷
│ Error: External Program Execution Failed
│
│ with data.external.simple-jq-test,
│ on main.tf line 8, in data "external" "simple-jq-test":
│ 8: program = ["bash", "./simple.sh"]
│
│ The data source received an unexpected error while attempting to execute the program.
│
│ Program: C:\Windows\system32\bash.exe
│ Error Message: ./simple.sh: line 4: jq: command not found
│
│ State: exit status 127
╵
You can take a look at the full
And with git bash
Finally things are working.
CodePudding user response:
you are stuck because of the complexity of different shell coexisting inside you Windows environment.
You may have installed jq in Windows, that does'nt mean it is accessible from everywhere. For example, you successfully called it from Powershell, because Powershell "knows" where to find for executables, and to look at the one called "jq".
I don't know what is you bash setup (was it installed via Git Bash, Cygwin, Msys, WSL{1,2}), but you need to make jq available for this shell as well. For instance, if your bash is on the "Windows" world, you may need to update the environment vaiable PATH to point toward the folder where choco installed your jq executable.
If your bash is in a Linux World (WSL), try to install jq in the right distribution you are using (for instance: sudo apt install jq if you distribution is Ubuntu)