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]}");
wooden-table-17264
09/09/2023, 11:16 PM
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."
wooden-table-17264
09/09/2023, 11:16 PM
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!
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.