terraform-provider-shell icon indicating copy to clipboard operation
terraform-provider-shell copied to clipboard

Raw Output instead of Output

Open scottwinkler opened this issue 3 years ago • 1 comments

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.

scottwinkler avatar Feb 05 '21 07:02 scottwinkler

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.

LukeCarrier avatar Jun 13 '21 14:06 LukeCarrier