docs
docs copied to clipboard
4 hours and i still cant get the name of a resource group into a stack output!
File: themes/default/content/docs/concepts/inputs-outputs/apply.md
All I want to do is get the name of a created Azure Resource Group to be somehow output by the stack so it can be used by the next step of a GitHub Action. Is that really so much to ask?
- Why does this page show me all the wrong ways to do it first? Just show me the right way!
- I cannot find a straightforward description of the difference between Ouput.Apply and Output.Create in C#
- I cannot find a straightforward description of the differences between the
Public Class MyStack()
approach and the
return await Deployment.RunAsync(() =>
{
some examples use one, some the other. I get that it's just a C# thing, but it would be good if the examples were consistent. It makes a difference when you are trying to return/expose values as Outputs.
Hi there @RDavis3000! Thanks for this detailed feedback -- we appreciate it and will definitely try to explain these better in the docs.
In the meantime, to your first question (about getting the resource group name), something like this should work -- it creates the resource group and then returns the group's name to export it as a Pulumi stack output, which you should then be able to read with pulumi stack output
as a follow-up step in your GitHub Actions workflow:
using Pulumi.AzureNative.Resources;
using System.Collections.Generic;
return await Pulumi.Deployment.RunAsync(() =>
{
// Create an Azure Resource Group.
var resourceGroup = new ResourceGroup("resourceGroup");
// Export the resource group name as a stack output.
return new Dictionary<string, object?>
{
["resourceGroupName"] = resourceGroup.Name
};
});
$ pulumi up
...
Updating (dev)
View in Browser (Ctrl+O): https://app.pulumi.com/christian-pulumi-corp/azure-csharp-1960446/dev/updates/1
Type Name Status
+ pulumi:pulumi:Stack azure-csharp-1960446-dev created (2s)
+ └─ azure-native:resources:ResourceGroup resourceGroup created (0.96s)
Outputs:
resourceGroupName: "resourceGroup0bda2692"
Resources:
+ 2 created
Duration: 4s
$ pulumi stack output resourceGroupName
resourceGroup0bda2692
Let me know if this helps! And apologies for confusion. We'll leave this open while we address your points 2 and 3.
I added a paragraph to disambiguate between stack outputs and Output<T> in #13332 ... This should prevent this kind of (very understandable) confusion in the future.