You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm probably just missing something obvious here, and if so apologies for the noise.
I'm attempting to take user input from HCL that is composed of data with types that are unknown until runtime. The example HCL could look something like this:
My first attempt was to decode this into cty Values and then transform using gocty.FromCtyValue(val, &decodedVal) where decoded val is map[string]interface{}. Of course, that doesn't work as FromCtyValue uses reflection on the type and maps to specific concrete types. interface{} doesn't match, so I get error: "incorrect type" which is the default error case.
I can see I could put something together using recursion myself, and if all else fails that's what I'll do. The only thing that has stopped me is the assumption that I must be missing a built in way to handle this case. Especially since the package docs have quite a bit of material on converting between unknown types etc.
The text was updated successfully, but these errors were encountered:
I'm probably just missing something obvious here, and if so apologies for the noise.
I'm attempting to take user input from HCL that is composed of data with types that are unknown until runtime. The example HCL could look something like this:
My first attempt was to decode this into cty Values and then transform using
gocty.FromCtyValue(val, &decodedVal)
where decoded val ismap[string]interface{}
. Of course, that doesn't work asFromCtyValue
uses reflection on the type and maps to specific concrete types.interface{}
doesn't match, so I geterror: "incorrect type"
which is the default error case.I can see I could put something together using recursion myself, and if all else fails that's what I'll do. The only thing that has stopped me is the assumption that I must be missing a built in way to handle this case. Especially since the package docs have quite a bit of material on converting between unknown types etc.
The text was updated successfully, but these errors were encountered: