https://pulumi.com logo
#general
Title
# general
w

wooden-table-17264

09/09/2023, 2:58 PM
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

billowy-army-68599

09/09/2023, 3:01 PM
you get that because the value isn’t known yet when you run a preview
w

wooden-table-17264

09/09/2023, 11:10 PM
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

billowy-army-68599

09/09/2023, 11:17 PM
Yep that’s exactly it!
w

wooden-table-17264

09/09/2023, 11:32 PM
Thank you for pointing me in the right direction. Have a good day!