Open cysp opened 2 months ago
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!
Terraform Version
Use Cases
I'm trying to generate config for an imported resource where some of its arguments are complex types that themselves contain JSON-encoded fields.
e.g. a resource has an argument represented as a list of JSON-encoded strings, which gets generated as a list of strings where each element is represented as an escaped JSON string (
argument = ["{\"foo\":\"bar\"}]
)Attempted Solutions
Since this is a provider I am developing myself, I did try changing the argument modelling to be a single JSON value but it feels like a worse representation and results in impedance mismatch with the API's SDK.
Proposal
The current config generation implementation opportunistically uses
jsonencode()
for root-level arguments if their values turn out to be valid JSON, perhaps this heuristic could be applied to all string values? In this case the argument fields make use of jsontypes, perhaps that could be used as a hint when generating configuration?References
No response