<@UB39JFCKC> I'm working with <@U013BJJB7E3> on th...
# dotnet
@tall-librarian-49374 I'm working with @strong-plastic-28250 on this project. He's new to C# and I've been working with it for several years. The question I have with this snippet is, are there any downsides to being explicit with async await? I see the comments in RunAsync and how it looks for all [Ouput] attributes and waits/loops until they've completed. Could the same be achieved without using [Output] attributes, using async awaits, awaiting RunAsync and within that, using Task.WaitAll? Maybe this is only an issue with StackReferences. It seems that to use something from a StackReference in the creation of a resource needs to happen within the
which feels sort of like
which is what async await tries to avoid, I think.
Yes, you should be able to do that..
You can either derive from the
class or pass a function to
, both will work including outputs.
I don’t think this is related to the error from James though?
I also responded in the thread above
Is it correct to say that if I wanted to use some value from a StackReference, like creating a LoadBalancer, I would need to create the LoadBalancer withing the Apply? Output.Create won't away right?
You could assign values from a stack reference to the Load Balancer properties.
Creating resources inside Apply is not recommended.
So if a value in a stack reference is needed and GetOutput is being used, how do you know if that task will complete before the creation of the resource that uses the value?
async await make async usable in a sync fasion, i'm trying to understand how [Output] and Apply does that.
Outputs take care of ordering for you, that’s the beauty. Once you have an output, you can freely use it everywhere.
Outputs are based on Tasks internally and we do completion sources etc behind the scenes.
So outputs, regardless of how many, are resolved before resource creation?
Yes. You can define a resource using unresolved outputs (as you do almost always, e.g. using a bucket name for a bucket object before the bucket exists). The actual creation operation will fire once all outputs-given-to-inputs are resolved.
So how do you pass Output<InputList> to Subnets on a LB creation?
If you have
[Output] public StackSubnets {get; set]
The type for
should be
. Also, you don’t need to make subnets the output of your stack, just declare a local variable.
Subnets = subnets
should work then
👍 1