terraform-provider-shell
terraform-provider-shell copied to clipboard
Raw Output instead of Output
Instead of forcing people to output JSON, it would be nice to have the option of outputting a string. e.g. echo "hello" would return just the string "hello". No need to wrap it in a JSON data structure. If someone is using this approach, only the last line of output will be considered.
JSON is still supported, but instead of flattening it on your behalf, just let people use decodejson() which is what people were doing anyways for deeply nested JSON outputs.
In the short term will support both, and mark output as deprecated. Output can be deprecated in a 2.0 release.
Also worth noting that since the output type is map(string)
the current implementation silently fails for deeply nested structures, which wouldn't be an issue with Terraform's own jsondecode()
. Given this limitation I don't think there's a compelling reason to handle the decode in the resource.