-
Notifications
You must be signed in to change notification settings - Fork 459
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
Replace ComplexComputedList
with native array with a single ComplexComputedObject
#993
Comments
ComplexComputedList
with native arrayComplexComputedList
with native array with a single ComplexObject
ComplexComputedList
with native array with a single ComplexObject
ComplexComputedList
with native array with a single ComplexComputedObject
Isn't this just a string list and therefore a string list token already? |
Whoops, you're right @skorfmann. I'll find a better example that uses a list of objects. |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
Currently we have a very limited way of working with lists as outputs of providers and the things we support make it clear that we don't deal with a native array but something else.
To make lists behave seamlessly we need to make them first class citizens by using native arrays.
To implement this properly we need to
put${propertyName}
method to the element that takes an object with only the not-computed types as a propertyThis also enables us to advance the work of #925 and expose computed types as well. The current problem there is that the interface expects a getter to have the type
DataKubernetesPersistentVolumeClaimSpecResource[]
, but in the current implementation it has(index: string) => DataKubernetesPersistentVolumeClaimSpecResources
.What this should enable
Currently inputs that are passed to a resource share the same type with references to that same attribute. For example, if we pass a string, we get back a string (which is an token encoded reference, but still appears to be a string). This is true for almost all types but not for lists. We want to achieve this for lists which contain objects (nested blocks) instead of plain values (lists of numbers or strings already return tokens encoded as a list of number / string containing the reference to that attribute).
Referencing list arguments also works in other languages than TS
When a list exists which can be set as input by the user, referencing that list does not work in other languages than TS (see: #1371). This allows the following to work:
todo: in Go referencing a list, passing it to e.g.
Fn.length
Passing a reference to a list works without "fqn" hack
Example in HCL
This equivalent now works:
Formerly this workaround was required (and did not work in other languages than TypeScript)
No more
listAttribute(index)
methodAs passing a list reference into
Fn.element()
works now this type of method is not needed anymore. It was not very idiomatic anyway as it treated the output (reference) to an attribute of a resources as a different type than the input for said attribute.Formerly
listAttribute
was a function (wat!?):Now it is a list, just like the related input:
References
The text was updated successfully, but these errors were encountered: