Closed dacamposol closed 3 months ago
Reading further the documentation, I found that the values of the resulting JSON must be strings, so nested objects aren't valid in this case.
The program must then produce a valid JSON object on stdout, which will be used to populate the result attribute exported to the rest of the Terraform configuration. This JSON object must again have all of its values as strings.
While that would be an useful scenario, it's not exactly a bug, so I'm closing this.
Terraform CLI and Provider Versions
Terraform v1.5.7 on darwin_arm64
Terraform Configuration
Expected Behavior
That
data.external.ias-application.result
contains the unmarshaled object.Actual Behavior
│ Error: Unexpected External Program Results │ │ with module.joule["development"].data.external.ias-application, │ on modules/joule/main.tf line 77, in data "external" "ias-application": │ 77: program = ["bash", "${path.module}/scripts/get_ias_application.sh"] │ │ The data source received unexpected results after executing the program. │ │ Program output must be a JSON encoded map of string keys and string values. │ │ If the error is unclear, the output can be viewed by enabling Terraform's logging at TRACE level. Terraform documentation on logging: https://www.terraform.io/internals/debugging │ │ Program: /bin/bash │ Result Error: json: cannot unmarshal object into Go value of type string
Steps to Reproduce
terraform plan
How much impact is this issue causing?
High
Logs
https://gist.github.com/dacamposol/5966e3579846dd0d00ed321c5cf729eb
Additional Information
As it can be seen, in L3963-3991 from the attached GitHub Gist, the output is a valid JSON, as it's the output from piping
jq
to a cURL command.Code of Conduct