This message was deleted.
# getting-started
s
This message was deleted.
w
Can you share your code? And the output of “pulumi stack”?
1
c
pulumi stack
Copy code
➜ pulumi stack
Current stack is test:
    Owner: bigday
    Last updated: 5 minutes ago (2022-06-07 22:10:05.7833997 +0200 CEST)
    Pulumi version: v3.33.2
Current stack resources (2):
    TYPE                              NAME
    pulumi:pulumi:Stack               bigday-test
    └─ pulumi:providers:azure-native  default_1_64_1

Current stack outputs (0):
    No output values currently in this stack

More information at: <https://app.pulumi.com/bigday/bigday/test>

Use `pulumi stack select` to change stack; `pulumi stack ls` lists known ones
Stack.cs
Copy code
using Pulumi;
using Storage = Pulumi.AzureNative.Storage;

class BigDayStack : Stack
{
    private readonly Pulumi.Config _config = new Pulumi.Config();

    private readonly string _stackName = Pulumi.Deployment.Instance.StackName;

    public BigDayStack()
    {
        // Create an Azure Resource Group
        var resourceGroup = new Pulumi.AzureNative.Resources.ResourceGroup($"rg-{_stackName}");

        var resourceGroup2 = new Pulumi.AzureNative.Resources.ResourceGroup($"rg2-{_stackName}");

        var storageAccount = new Pulumi.AzureNative.Storage.StorageAccount("sa", new Storage.StorageAccountArgs
        {
            Kind = Storage.Kind.StorageV2,
            ResourceGroupName = resourceGroup.Name,
            Sku = new Storage.Inputs.SkuArgs
            {
                Name = Storage.SkuName.Standard_LRS,
            },
        });
    }
}
Copy code
➜ pulumi preview
Previewing update (test)

View Live: <https://app.pulumi.com/bigday/bigday/test/previews/54d15945-ece2-4951-878b-69e06f893cbd>

     Type                 Name         Plan
     pulumi:pulumi:Stack  bigday-test

Resources:
    1 unchanged
I'm pretty sure I'm doing something wrong, but I just don't see it. I'm at day one of using Pulumi, so still reading through docs and playing around.
w
It doesn’t look too strange. But, I’m not a C# expert, so in an attempt to be consistent with other C# examples I would try moving the config stuff inside of the
public BigDayStack
block.
And the
_stackName
bit
c
I tried, but it seems to be the same thing
It's just not picking up
w
I’m curious if you create a new folder and do a
pulumi new azure-csharp
- does that work? It should create a resource group and storage account.
c
I will give it a shot.
Yes
It works. Then it shows me the preview and everything
And
details
actually gives me details and not just nothing
w
Yeah so there’s something different about your original code. It may be worthwhile to go step by step and modify the
pulumi new
generated code to match your original code and see where things go off the rails.
Is it possible in your original code that
Program.cs
is not referencing
BigDayStack
?
c
... I'm an idiot
I forgot to
await
the call to
Deployment.RunAsync
w
lol - I know that feeling 🙂
🙏 1
c
After I changed it to use top level statements
w
Aha - lesson learned. 🙂
c
Haha, then it makes sense why it was giving such a weird result 😅
Seems to work fine now.
Thanks for your help @witty-candle-66007
w
no problem - glad you figured it out.
👍 1
c
It even works with the code I had to begin with 🚀
🎉 1