https://pulumi.com logo
#getting-started
Title
# getting-started
c

clever-address-74879

06/07/2022, 8:12 PM
I tried
pulumi refresh
and then
pulumi up
and even
pulumi down
and
pulumi up
but it's just not picking up the changes.
w

witty-candle-66007

06/07/2022, 8:14 PM
Can you share your code? And the output of “pulumi stack”?
1
c

clever-address-74879

06/07/2022, 8:15 PM
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

witty-candle-66007

06/07/2022, 8:24 PM
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

clever-address-74879

06/07/2022, 8:28 PM
I tried, but it seems to be the same thing
It's just not picking up
w

witty-candle-66007

06/07/2022, 8:31 PM
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

clever-address-74879

06/07/2022, 8:31 PM
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

witty-candle-66007

06/07/2022, 8:35 PM
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

clever-address-74879

06/07/2022, 8:41 PM
... I'm an idiot
I forgot to
await
the call to
Deployment.RunAsync
w

witty-candle-66007

06/07/2022, 8:41 PM
lol - I know that feeling 🙂
🙏 1
c

clever-address-74879

06/07/2022, 8:41 PM
After I changed it to use top level statements
w

witty-candle-66007

06/07/2022, 8:41 PM
Aha - lesson learned. 🙂
c

clever-address-74879

06/07/2022, 8:42 PM
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

witty-candle-66007

06/07/2022, 8:43 PM
no problem - glad you figured it out.
👍 1
c

clever-address-74879

06/07/2022, 8:44 PM
It even works with the code I had to begin with 🚀
🎉 1
11 Views