Hi
Kind of new at this, so apology in advance if I’m asking a question that was answered already.
I’m trying to generate a tf file using the golang cty library.
It’s pretty straightforward. However, I have this section:
Do you already have some code that’s generating a similar structure to what you want? It would help if you could share what you already tried as a starting point. Thanks!
Thanks @maxb the thing is that the “jsoncode” is in the second layer (below “custom_fields”) on the body block.
any suggestion how can I “SetAttributeRaw” inside a “SetAttributeValue” ?
You can’t - you have to use SetAttributeRaw instead of SetAttributeValue.
There are other helper functions such as hclwrite.TokensForObject which can help you build up an object literal, and then you can switch to hclwrite.TokensForValue to create the deeper parts of a value which are pure data, without function calls or similar.