Hello, Could someone help me with Output.All(reso...
# general
w
Hello, Could someone help me with Output.All(resourceGroup.Name, resourceGroup.Location) .Apply(values => $"Resource Group: {values[0]}, Location: {values[1]}")? When I run 'pulumi preview' I get output<string>. Not sure why. I use Pulumi 3.81 C#. I would really appreciate the help. Thank you.
b
you get that because the value isn’t known yet when you run a preview
w
Thank you, Jaxx for the reply! I got it. I am introducing pulumi to my team. Just want to learn about it before jumping in. The code is simple creating a Azure resource group. I specified both values. Is there any way to print them out during the preview or I should assign the to variables and specify them like so var resourceName = "rg-pulumitest-staging"; in the All() and Appy(). The code: var resourceGroup = new ResourceGroup("rg-pulumitest-staging", new() { ResourceGroupName = "rg-pulumitest-staging", Location = "EastUS" }); ResourceGroup = Output.All(resourceGroup.Name, resourceGroup.Location) .Apply(values => $"Resource Group: {values[0]}, Location: {values[1]}");
Oh I just read this on pulumi output page "During some program executions,
apply
doesn’t run. For example, it won’t run during a preview, when resource output values may be unknown."
Thank you for the help!
b
Yep that’s exactly it!
w
Thank you for pointing me in the right direction. Have a good day!