Natively handling "object" values between resources #1292
Unanswered
thejosephstevens
asked this question in
Q&A
Replies: 1 comment
-
It's an interesting case, and is something I think we should handle better. I know there has been some work done on this related to correctly mappen tf objects correctly, but it seems like we are not completely there yet. A workaround I'm currently using at my day job is outputting everything as a Json encoded string when creating outputs, and then when a module uses that output do a jsondecode inside the Terraform module. It's a hacky workaround, but it works. It's definitely something that we still need to work on. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there! I have two modules, representing a multi-cloud identity provider, and a multi-cloud identity. The design is, any time a k8s cluster is registered, it gets Identity Providers created so that OIDC can be used to authenticate its workloads. Each Service Account workload can then be assigned an identity across clouds (this results in many identities being associated with the identity provider resources). In order to drive this, I want to keep the integration points clean, so I constructed an output object that contained all of the relevant details for the provider:
This then gets written to a secret:
Which is then picked up by the identity:
In order to fulfill the variable for the identity:
Composing it this way keeps the interfaces super clean. The trouble I'm running into is that it looks like the handling from the TF-Controller is interpreting the output JSON as a string when it interpolates it into the identity resource (see the extra quoting on the
identity_provider
value below). As you can see, the__type
key from the output secret is also being imported, and has the correct type data for the output value.:The stored output data itself looks like it is structured in a way I would expect:
I'm confident that I can do full mapping to get past this issue (output everything as a primitive and then perform key-mapping to get them into the identity resource object in YAML), but I wanted to check whether this is expected to work or not. I found this discussion, which was similar, but not quite the same thing I was encountering. I'm running
0.16.0-rc.4
from Helm.My assumption is there's some guard here to keep from inferring object type on inputs that look like JSON, but it would be really fantastic if this could work natively without additional handling in the middle (when the objects are identical on the output and input side).
Thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions