-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested conversion using gocty.FromCtyValue fails #38
Comments
Adding a minimal reproduction file: |
Hi @DavidGamba! I think this may be related to #17, but I'm not totally sure yet because I've not traced this through all of the HCL layers to see what the final In the meantime, you might find it simpler to go directly from HCL to a Go struct, without the intermediate |
@apparentlymart thanks for the reply, I'll dive into gohcl and report back, sorry for the delay. |
@apparentlymart I have a working implementation using
But haven't figured out how to yet, that is why I started diving into the cty code. Thanks! |
Hi @DavidGamba, I think you're describing the pattern that's covered in the HCL manual as Interdependent Blocks. There isn't a complete code example there but it does give some hints on how to achieve it, though written under the assumption that you've already read earlier content like Decoding into Native Go Values. If you'd like to discuss that some more I'm happy to work with you in an issue in the HCL repository. |
Thanks for the pointers, I'll close the issue here and open an issue in the HCL repo if I can't manage to figure it out. |
Given a spec:
I can parse basic HCL:
Then converting to a golang struct works:
However, when I try to do a nested structure:
I haven't been able to convert to a native golang struct:
and
gocty.FromCtyValue
always fails with "object or tuple value is required".The text was updated successfully, but these errors were encountered: