sparse-intern-71089
12/20/2023, 9:48 AMboundless-petabyte-41580
12/20/2023, 2:23 PMInput<T>
is defined as type Input<T> = T | Promise<T> | Output<T>
boundless-petabyte-41580
12/20/2023, 2:24 PMpulumi.output
to force it into an Output
and then .apply
boundless-petabyte-41580
12/20/2023, 2:24 PMboundless-petabyte-41580
12/20/2023, 2:27 PMlittle-cartoon-10569
12/20/2023, 6:47 PMx
of type { id: string }
, Pulumi will interpret x.id
as x.apply((o) => o.id)
, so you can omit using apply()
.most-napkin-55076
12/21/2023, 7:53 AMmost-napkin-55076
12/21/2023, 8:05 AMconst bucket: Output<Bucket>
, where Bucket := { name: Output<string> }
, which is the case when I return the entire bucket object from the ComponentResource
, and pass it as to a parameter bucketInput: Input<Bucket>
, bucketInput.name
is no longer reference-able because apparently name
does not exist on bucketInput
.boundless-petabyte-41580
12/21/2023, 4:01 PMpulumi.output
is mostly for accessing nested structures. It also coerces every Input
into Output
so you have a predictable interface to work with.
Theoretically, to stay in input land you could implement something like
function apply<T, T1>(input: Input<T>, f: (t: T) => Input<T1>): Input<T1>
but you'd need path-dependent types, since you don't know if the input
you're working with has the same monad as f
little-cartoon-10569
12/21/2023, 6:03 PMpulumi.output()
just to force consistency in the code.little-cartoon-10569
12/21/2023, 6:07 PMOutput<Bucket>
. Output only ever wrap primitives and arrays of primitives. And in some unfortunate cases, other Outputs or Inputs (though in my experience, those cases might have been able to be reduced to just primitives, with a bit more work in the provider classes).little-cartoon-10569
12/21/2023, 6:08 PMOutput<Bucket>
can be changed to return either a Bucket
or an Output<string>
(being the ARN or bucket name), depending on requirements.most-napkin-55076
01/02/2024, 7:29 AMComponentResource
, that wraps other resources, such as the Bucket
, as Output, and for me it would just be preferred to not having to unwrap all of the properties of each "child" resource, for then in turn having to pass multiple primitive values around to, potentially, a single resource, as is the case for me, because I have to use multiple properties of a Bucket
in a separate component.
So it's not as much as I can't get it to work, it's more that the way that works, really feels to overcomplicate something that, from the outside at least, is pretty simple., But maybe the way to go is just to map Inputs to Outputs whenever they're reference objects and call it a day?little-cartoon-10569
01/03/2024, 12:49 AMmost-napkin-55076
01/04/2024, 7:34 AMinitialize()
and .getData()
to initialize the components, which returns a promise, but I guess that's really not mandatory then? (note, I didn't initially make this, I've just been expanding on it, so a lot of learning still)little-cartoon-10569
01/07/2024, 9:04 PMmost-napkin-55076
01/08/2024, 8:33 AMlittle-cartoon-10569
01/08/2024, 6:11 PM