I am trying to use the external data source provider https://www.terraform.io/docs/providers/external/data_source.html to run a bash script. Within the bash script i have a jq command, I keep getting jq package not found. When I try to install Jq it errors out because the output of the command install doesn’t come out as json which is a requirement for using the external data source provider. Any help is appreciated
The documentation for the
external data source still refers only to Terraform Enterprise since it predates the introduction of Terraform Cloud, but the warning there applies equally to both:
Warning: Terraform Enterprise does not guarantee availability of any particular language runtimes or external programs beyond standard shell utilities, so it is not recommended to use this data source within configurations that are applied within Terraform Enterprise.
There’s more information on the execution environment in Terraform Cloud’s Run Environment. There’s a link from there to a guide about installing additional software which strongly recommends against it but still includes an example of downloading
jq prior to running it, relying on that
jq binary being a standalone executable that doesn’t depend on any special system libraries to be available.
external data source, due to its reliance on the surrounding execution environment, is aimed mainly at folks running Terraform CLI on their own infrastructure where they can totally control the surrounding environment. Depending on what your external bash script is intended to do, there may be other ways to get it done with Terraform that do not rely directly on external software.